JBoss Community

Re: FieldWriteInvocation.getValue does not reflecting changes made along interceptors

created by Rick Dong in JBoss AOP - View the full discussion

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 bold part be SET_VALUE instead?

Reply to this message by going to Community

Start a new discussion in JBoss AOP at Community