[jboss-user] [JBoss AOP] - Re: FieldWriteInvocation.getValue does not reflecting changes made along interceptors

Rick Dong do-not-reply at jboss.com
Sat Nov 20 01:11:11 EST 2010


Rick Dong [http://community.jboss.org/people/rick.dong] created the discussion

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

To view the discussion, visit: http://community.jboss.org/message/572066#572066

--------------------------------------------------------------
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
[http://community.jboss.org/message/572066#572066]

Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101120/9e072109/attachment.html 


More information about the jboss-user mailing list