-
1. Re: FieldWriteInvocation.getValue does not reflecting changes made along interceptors
rick.dong Nov 20, 2010 1:13 AM (in response to rick.dong)digging into the code, it seems that this could be a bug
private static class WriteBaseClassGenerator extends BaseClassGenerator
{
private static final String GET_VALUE = "getValue";
private static final String SET_VALUE = "setValue";
....protected CtClass setupClass()throws NotFoundException, CannotCompileException
{
CtClass setUp = super.setupClass();
CtField valueField = new CtField(getArgumentType(), TYPED_VALUE_FIELD, setUp);
jp.addField(valueField);
CtMethod oldGetValue = WRITE_INVOCATION_CT_TYPE.getDeclaredMethod(GET_VALUE);
CtMethod getValue = CtNewMethod.make(oldGetValue.getReturnType(),
GET_VALUE, oldGetValue.getParameterTypes(),
oldGetValue.getExceptionTypes(), "{return ($w)" + TYPED_VALUE_FIELD + ";}",
setUp);
setUp.addMethod(getValue);
CtMethod oldSetValue = WRITE_INVOCATION_CT_TYPE.getDeclaredMethod(SET_VALUE);
CtMethod setValue = CtNewMethod.make(oldSetValue.getReturnType(),
GET_VALUE, oldSetValue.getParameterTypes(),
oldSetValue.getExceptionTypes(), "{" + TYPED_VALUE_FIELD + " = " +
JavassistToReflect.castInvocationValueToTypeString(getArgumentType(),
"$1") + ";}", setUp);
setUp.addMethod(setValue);
return setUp;
}Shouldn't the bolded part be SET_VALUE instead for the set to take effect?
Message was edited by: Rick Dong