3 Replies Latest reply on Mar 25, 2008 2:53 PM by Ales Justin

    AnnotatedClassFilter is wrong + AOP

    Adrian Brock Master

      The AnnotatedClassFilter has a number of problems.

      1) It doesn't understand about "subdeployments" or in this particular case
      that WEB-INF and WEB-INF/classes are in the classpath

      e.g.

      2008-03-25 18:17:10,505 DEBUG [org.jboss.classloader.spi.base.BaseClassLoader] (RMI TCP Connection(16)-127.0.0.1) Created BaseClassLoader@1e3b325{vfsfile:/home/ejort/j
      boss-head/testsuite/output/lib/aop-scopedear1.ear/aop-scopedear1.war} with policy
      ...
      JarEntryContents@27626654[path=aop-scopedear1.war/WEB-INF/classes JarEntryContents@28507864[path=aop-scopedear1.war/WEB-INF
      ...
      


      It tries to load each class twice

      2008-03-25 18:17:10,594 ERROR [STDERR] (RMI TCP Connection(16)-127.0.0.1) [error] Error converting class .. Do verbose mode if you want full stack trace.
      2008-03-25 18:17:10,595 DEBUG [org.jboss.deployment.AnnotatedClassFilter] (RMI TCP Connection(16)-127.0.0.1) Incomplete class: classes.org.jboss.test.aop.scoped.ear.se
      rvlet.EarExampleServlet, NCDFE: java.lang.NoClassDefFoundError: classes/org/jboss/test/aop/scoped/ear/servlet/EarExampleServlet (wrong name: org/jboss/test/aop/scoped/
      ear/servlet/EarExampleServlet)
      


      Also, I don't think it understands how AOP is done?

      2) With AOP there is also an in memory virtual file to store classes
      that AOP has weaved. I think this is going to lead to the classes getting
      processed twice? Once using the non-weaved version then using the
      weaved version?

      Which brings up another unrelated issue in that at the moment,
      I believe the in memory virtual file is after the unweaved virtual file in the classpath?

      3) The current way of scanning classes for annotations is not scalable
      (or even extensible).
      It loads a collection of all classes found then runs each class through
      the processors. This should be a true visitor pattern otherwise a deployment
      with thousands of classes is possibly going to run out memory?

      4) It doesn't take into account the classloading policy in that some parts of
      the classpath could be excluded by filters.