1 Reply Latest reply on Jan 12, 2009 2:46 PM by stalep

    Using ClassInfo in AOP

    kabirkhan

      Ståle,

      I think the first thing to do is to fix jboss-reflect (alternatively hack together a prototype in aop before fixing this in jboss-reflect). http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199605#4199605.

      I have not looked at the AOP side of this for a while, but the most important initial thing is to unify the duplicate code in the pointcut matchers so that they come in one version all using ClassInfo. I would concentrate on the weaving part first:

      Weaving
      ======
      1) Create a javassist Type/ClassInfo for the class being woven in the instrumentor from the CtClass and ClassLoader.
      2) Modify the instrumentor, transformers and pointcut matchers to use ClassInfo instead of CtClass. We still want to use the raw CtClass when adding wrapper methods, inner classes etc. to the class being woven since ClassInfo does not support that. So the minimum required for this step is probably to use ClassInfo for what is passed into the matchers.

      Runtime
      ======
      1) When recaclulating the advisor chains use the reflect version of ClassInfo and modify the matchers to use that.

      Once this is done, we can look at other places to add ClassInfo.

        • 1. Re: Using ClassInfo in AOP
          stalep

          i started changing the pointcut matchers to use ClassInfo instead of CtClass just to get a grasp of things and it seems that is not easy to "only" change matchers or instrumentor, etc.
          look at just creating org.jboss.aop.pointcut.Util.matchesClassExpr(ClassExpression classExpr, ClassInfo classInfo, Advisor advisor) to work similar as the javassist/reflect version.
          then we need to create a ClassInfo "version" of org.jboss.aop.annotation.PortableAnnotationElement. isAnyAnnotationPresent(...). this method needs uses javassist.ClassFile to fetch annotationinformation regarding the visibility of the annotation. these kind of methods are not available in jboss-reflect AnnotationType/AnnotationValue/TypeInfo afaik.
          so either we end up using javassist for these kind of operations (which is totally against why we do it in the first place) or we need to get a better overview of what functionality we need from the reflect api to use it in aop.
          atm im only thinking of the non-mutable-info we need, but maybe we should include the mutableinfo discussion into this?