[jboss-cvs] JBossAS SVN: r95130 - in projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki: repository/plugins and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 19 14:29:38 EDT 2009


Author: alesj
Date: 2009-10-19 14:29:38 -0400 (Mon, 19 Oct 2009)
New Revision: 95130

Removed:
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtClassAdapter.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtConstructorAdapter.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtFieldAdapter.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMemberAdapter.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMethodAdapter.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/reflection/
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/spi/
Modified:
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/GenericAnnotationResourceVisitor.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/WeakClassLoaderHolder.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/JavassistAnnotationResourceVisitor.java
   projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java
Log:
Use JBoss Reflect. ;-)

Modified: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/GenericAnnotationResourceVisitor.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/GenericAnnotationResourceVisitor.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/GenericAnnotationResourceVisitor.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -27,8 +27,14 @@
 import org.jboss.classloading.spi.visitor.ResourceVisitor;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.spi.signature.Signature;
-import org.jboss.papaki.repository.spi.ClassAdapter;
-import org.jboss.papaki.repository.spi.MemberAdapter;
+import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory;
+import org.jboss.reflect.spi.AnnotatedInfo;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.spi.ConstructorInfo;
+import org.jboss.reflect.spi.MemberInfo;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.reflect.spi.TypeInfoFactory;
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
@@ -40,7 +46,7 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public abstract class GenericAnnotationResourceVisitor implements ResourceVisitor
+public class GenericAnnotationResourceVisitor implements ResourceVisitor
 {
    private static final Logger log = Logger.getLogger(GenericAnnotationResourceVisitor.class);
 
@@ -49,16 +55,33 @@
    private boolean checkSuper;
    private boolean checkInterfaces = true;
    private DefaultAnnotationRepository repository;
+   private TypeInfoFactory typeInfoFactory = createTypeInfoFactory();
 
    public GenericAnnotationResourceVisitor(DefaultAnnotationRepository repository)
    {
       this.repository = repository;
    }
 
-   protected abstract boolean isRelevant(ClassAdapter classAdapter);
+   protected TypeInfoFactory createTypeInfoFactory()
+   {
+      return new IntrospectionTypeInfoFactory();
+   }
 
-   protected abstract ClassAdapter createClassAdapter(ResourceContext context) throws Exception;
+   @SuppressWarnings("deprecation")
+   protected boolean isRelevant(ClassInfo ci)
+   {
+      return ci.getType().equals(Object.class) == false;
+   }
 
+   protected ClassInfo createClassInfo(ResourceContext context) throws Exception
+   {
+      TypeInfo typeInfo = typeInfoFactory.getTypeInfo(context.loadClass());
+      if (typeInfo instanceof ClassInfo == false)
+         throw new IllegalArgumentException("Can only handle class info: " + typeInfo);
+
+      return ClassInfo.class.cast(typeInfo);
+   }
+
    public ResourceFilter getFilter()
    {
       return resourceFilter;
@@ -68,24 +91,16 @@
    {
       try
       {
-         ClassAdapter ctClass = createClassAdapter(resource);
-         try
+         ClassInfo ctClass = createClassInfo(resource);
+         List<CommitElement> commit = createCommitList();
+         handleClass(ctClass, commit);
+         if (commit.isEmpty() == false)
          {
-            List<CommitElement> commit = createCommitList();
-            handleClass(ctClass, commit);
-            if (commit.isEmpty() == false)
+            for (CommitElement ce : commit)
             {
-               for (CommitElement ce : commit)
-               {
-                  repository.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
-               }
+               repository.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
             }
          }
-         finally
-         {
-            if (ctClass != null)
-               ctClass.detach();
-         }
       }
       catch (ClassNotFoundException e)
       {
@@ -125,16 +140,16 @@
    /**
     * Handle class adapter for annotations.
     *
-    * @param classAdapter the class adapter instance
-    * @param commit  the commit list
-    * @throws Exception      for any annotations lookup problems
+    * @param classInfo the class info instance
+    * @param commit    the commit list
+    * @throws Exception for any annotations lookup problems
     */
-   protected void handleClass(ClassAdapter classAdapter, List<CommitElement> commit) throws Exception
+   protected void handleClass(ClassInfo classInfo, List<CommitElement> commit) throws Exception
    {
-      if (classAdapter == null || isRelevant(classAdapter) == false)
+      if (classInfo == null || isRelevant(classInfo) == false)
          return;
 
-      String className = classAdapter.getName();
+      String className = classInfo.getName();
       if (repository.isAlreadyChecked(className))
       {
          if (log.isTraceEnabled())
@@ -142,7 +157,7 @@
          return;
       }
 
-      if (checkInterfaces == false && classAdapter.isInterface())
+      if (checkInterfaces == false && classInfo.isInterface())
       {
          if (log.isTraceEnabled())
             log.trace("Skipping interface: " + className);
@@ -152,27 +167,27 @@
       if (log.isTraceEnabled())
          log.trace("Scanning class " + className + " for annotations");
 
-      Object[] annotations = forceAnnotations ? classAdapter.getAnnotations() : classAdapter.getAvailableAnnotations();
+      Object[] annotations = classInfo.getAnnotations();
       handleAnnotations(ElementType.TYPE, (Signature)null, annotations, className, commit);
 
-      handleMembers(ElementType.CONSTRUCTOR, classAdapter.getDeclaredConstructors(), className, commit);
-      handleMembers(ElementType.METHOD, classAdapter.getDeclaredMethods(), className, commit);
-      handleMembers(ElementType.FIELD, classAdapter.getDeclaredFields(), className, commit);
+      handleMembers(ElementType.CONSTRUCTOR, classInfo.getDeclaredConstructors(), className, commit);
+      handleMembers(ElementType.METHOD, classInfo.getDeclaredMethods(), className, commit);
+      handleMembers(ElementType.FIELD, classInfo.getDeclaredFields(), className, commit);
 
       if (checkSuper)
       {
          if (checkInterfaces)
          {
             // interfaces
-            ClassAdapter[] interfaces = classAdapter.getInterfaces();
+            ClassInfo[] interfaces = classInfo.getInterfaces();
             if (interfaces != null && interfaces.length > 0)
             {
-               for (ClassAdapter intf : interfaces)
+               for (ClassInfo intf : interfaces)
                   handleClass(intf, commit);
             }
          }
          // super class
-         handleClass(classAdapter.getSuperclass(), commit);
+         handleClass(classInfo.getSuperclass(), commit);
       }
    }
 
@@ -185,26 +200,40 @@
     * @param commit    the commit list
     * @throws Exception for any annotations lookup problems
     */
-   protected void handleMembers(ElementType type, MemberAdapter[] members, String className, List<CommitElement> commit) throws Exception
+   protected void handleMembers(ElementType type, AnnotatedInfo[] members, String className, List<CommitElement> commit) throws Exception
    {
       if (members != null && members.length > 0)
       {
-         for (MemberAdapter member : members)
+         for (AnnotatedInfo ainfo : members)
          {
-            Object[] annotations = forceAnnotations ? member.getAnnotations() : member.getAvailableAnnotations();
+            if (ainfo instanceof MemberInfo == false)
+               throw new IllegalArgumentException("Can only handle member info: " + ainfo);
+
+            Object[] annotations = ainfo.getAnnotations();
+            MemberInfo member = MemberInfo.class.cast(ainfo);
             handleAnnotations(type, member, annotations, className, commit);
-            if (member.isParametrized())
+            if (isParametrized(ainfo))
             {
-               Object[][] paramAnnotations = forceAnnotations ? member.getParameterAnnotations() : member.getAvailableParameterAnnotations();
-               for (int index = 0; index < paramAnnotations.length; index++)
+               Object[][] paramAnnotations = getParameterAnnotations(ainfo);
+               for (Object[] paramAnnotation : paramAnnotations)
                {
-                  handleAnnotations(ElementType.PARAMETER, member.getSignature(index), paramAnnotations[index], className, commit);
+                  handleAnnotations(ElementType.PARAMETER, Signature.getSignature(member), paramAnnotation, className, commit);
                }
             }
          }
       }
    }
 
+   protected boolean isParametrized(AnnotatedInfo member)
+   {
+      return member instanceof MethodInfo || member instanceof ConstructorInfo;
+   }
+
+   protected Object[][] getParameterAnnotations(AnnotatedInfo ainfo)
+   {
+      return null; // TODO
+   }
+
    /**
     * Handle annotations.
     *
@@ -215,11 +244,11 @@
     * @param commit      the commit list
     * @throws Exception for any annotations lookup problems
     */
-   protected static void handleAnnotations(ElementType type, MemberAdapter member, Object[] annotations, String className, List<CommitElement> commit) throws Exception
+   protected static void handleAnnotations(ElementType type, MemberInfo member, Object[] annotations, String className, List<CommitElement> commit) throws Exception
    {
       Signature signature = null;
       if (member != null)
-         signature = member.getSignature();
+         signature = Signature.getSignature(member);
 
       handleAnnotations(type, signature, annotations, className, commit);
    }

Modified: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/WeakClassLoaderHolder.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/WeakClassLoaderHolder.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/WeakClassLoaderHolder.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -60,20 +60,6 @@
    }
 
    /**
-    * Set ClassLoader.
-    *
-    * @param classLoader the classloader
-    */
-   void setClassLoader(ClassLoader classLoader)
-   {
-      ClassLoader oldCL = (clRef != null) ? clRef.get() : null;
-      if (oldCL != null && classLoader.equals(oldCL) == false)
-         throw new IllegalArgumentException("Trying to override existing classloader: " + oldCL + "!=" + classLoader);
-
-      clRef = new WeakReference<ClassLoader>(classLoader);
-   }
-
-   /**
     * Load class from class name.
     *
     * @param className the class name

Deleted: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtClassAdapter.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtClassAdapter.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtClassAdapter.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.papaki.repository.plugins.javassist;
-
-import org.jboss.papaki.repository.spi.ClassAdapter;
-import org.jboss.papaki.repository.spi.MemberAdapter;
-
-import javassist.CtClass;
-import javassist.CtConstructor;
-import javassist.CtMethod;
-import javassist.CtField;
-
-/**
- * Javassist class adapter.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class CtClassAdapter implements ClassAdapter
-{
-   private CtClass ctClass;
-
-   public CtClassAdapter(CtClass ctClass)
-   {
-      this.ctClass = ctClass;
-   }
-
-   CtClass getCtClass()
-   {
-      return ctClass;
-   }
-
-   public String getName()
-   {
-      return ctClass.getName();
-   }
-
-   public boolean isInterface()
-   {
-      return ctClass.isInterface();
-   }
-
-   public MemberAdapter[] getDeclaredConstructors()
-   {
-      CtConstructor[] ctors = ctClass.getDeclaredConstructors();
-      MemberAdapter[] adapters = new MemberAdapter[ctors.length];
-      for (int i = 0; i < ctors.length; i++)
-         adapters[i] = new CtConstructorAdapter(ctors[i]);
-      return adapters;
-   }
-
-   public MemberAdapter[] getDeclaredMethods()
-   {
-      CtMethod[] methods = ctClass.getDeclaredMethods();
-      MemberAdapter[] adapters = new MemberAdapter[methods.length];
-      for (int i = 0; i < methods.length; i++)
-         adapters[i] = new CtMethodAdapter(methods[i]);
-      return adapters;
-   }
-
-   public MemberAdapter[] getDeclaredFields()
-   {
-      CtField[] fields = ctClass.getDeclaredFields();
-      MemberAdapter[] adapters = new MemberAdapter[fields.length];
-      for (int i = 0; i < fields.length; i++)
-         adapters[i] = new CtFieldAdapter(fields[i]);
-      return adapters;
-   }
-
-   public ClassAdapter getSuperclass() throws Exception
-   {
-      CtClass superclass = ctClass.getSuperclass();
-      return superclass != null ? new CtClassAdapter(superclass) : null;
-   }
-
-   public ClassAdapter[] getInterfaces() throws Exception
-   {
-      CtClass[] ifaces = ctClass.getInterfaces();
-      CtClassAdapter[] adapters = new CtClassAdapter[ifaces.length];
-      for (int i = 0; i < ifaces.length; i++)
-         adapters[i] = new CtClassAdapter(ifaces[i]);            
-      return adapters;
-   }
-
-   public void detach()
-   {
-      ctClass.detach();
-   }
-
-   public Object[] getAnnotations() throws ClassNotFoundException
-   {
-      return ctClass.getAnnotations();
-   }
-
-   public Object[] getAvailableAnnotations()
-   {
-      return ctClass.getAvailableAnnotations();
-   }
-}
\ No newline at end of file

Deleted: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtConstructorAdapter.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtConstructorAdapter.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtConstructorAdapter.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.papaki.repository.plugins.javassist;
-
-import org.jboss.metadata.spi.signature.Signature;
-import org.jboss.metadata.spi.signature.javassist.JavassistConstructorParametersSignature;
-import org.jboss.metadata.spi.signature.javassist.JavassistConstructorSignature;
-
-import javassist.CtConstructor;
-
-/**
- * Javassist member adapter.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class CtConstructorAdapter extends CtMemberAdapter<CtConstructor>
-{
-   public CtConstructorAdapter(CtConstructor ctor)
-   {
-      super(ctor);
-   }
-
-   public Signature getSignature() throws Exception
-   {
-      return new JavassistConstructorSignature(member);
-   }
-
-   public Signature getSignature(int index) throws Exception
-   {
-      return new JavassistConstructorParametersSignature(member, index);
-   }
-}
\ No newline at end of file

Deleted: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtFieldAdapter.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtFieldAdapter.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtFieldAdapter.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.papaki.repository.plugins.javassist;
-
-import org.jboss.metadata.spi.signature.Signature;
-import org.jboss.metadata.spi.signature.javassist.JavassistFieldSignature;
-
-import javassist.CtField;
-
-/**
- * Javassist member adapter.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class CtFieldAdapter extends CtMemberAdapter<CtField>
-{
-   public CtFieldAdapter(CtField field)
-   {
-      super(field);
-   }
-
-   public Signature getSignature()
-   {
-      return new JavassistFieldSignature(member);
-   }
-
-   public Signature getSignature(int index) throws Exception
-   {
-      throw new IllegalArgumentException("Fields cannot have parameters.");
-   }
-}
\ No newline at end of file

Deleted: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMemberAdapter.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMemberAdapter.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMemberAdapter.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.papaki.repository.plugins.javassist;
-
-import org.jboss.papaki.repository.spi.MemberAdapter;
-
-import javassist.CtBehavior;
-import javassist.CtMember;
-
-/**
- * Javassist member adapter.
- *
- * @param <T> exact member type
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class CtMemberAdapter<T extends CtMember> implements MemberAdapter
-{
-   protected T member;
-
-   public CtMemberAdapter(T member)
-   {
-      this.member = member;
-   }
-
-   public boolean isParametrized()
-   {
-      return (member instanceof CtBehavior);
-   }
-
-   public Object[][] getParameterAnnotations() throws ClassNotFoundException
-   {
-      CtBehavior behavior = (CtBehavior)member;
-      return behavior.getParameterAnnotations(); 
-   }
-
-   public Object[][] getAvailableParameterAnnotations()
-   {
-      CtBehavior behavior = (CtBehavior)member;
-      return behavior.getAvailableParameterAnnotations();
-   }
-
-   public Object[] getAnnotations() throws ClassNotFoundException
-   {
-      return member.getAnnotations();
-   }
-
-   public Object[] getAvailableAnnotations()
-   {
-      return member.getAvailableAnnotations();
-   }
-}
\ No newline at end of file

Deleted: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMethodAdapter.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMethodAdapter.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/CtMethodAdapter.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.papaki.repository.plugins.javassist;
-
-import org.jboss.metadata.spi.signature.Signature;
-import org.jboss.metadata.spi.signature.javassist.JavassistMethodParametersSignature;
-import org.jboss.metadata.spi.signature.javassist.JavassistMethodSignature;
-
-import javassist.CtMethod;
-
-/**
- * Javassist member adapter.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class CtMethodAdapter extends CtMemberAdapter<CtMethod>
-{
-   public CtMethodAdapter(CtMethod method)
-   {
-      super(method);
-   }
-
-   public Signature getSignature() throws Exception
-   {
-      return new JavassistMethodSignature(member);
-   }
-
-   public Signature getSignature(int index) throws Exception
-   {
-      return new JavassistMethodParametersSignature(member, index);
-   }
-}
\ No newline at end of file

Modified: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/JavassistAnnotationResourceVisitor.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/JavassistAnnotationResourceVisitor.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/JavassistAnnotationResourceVisitor.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -22,9 +22,11 @@
 package org.jboss.papaki.repository.plugins.javassist;
 
 import org.jboss.classloading.spi.visitor.ResourceContext;
+import org.jboss.papaki.repository.plugins.DefaultAnnotationRepository;
 import org.jboss.papaki.repository.plugins.GenericAnnotationResourceVisitor;
-import org.jboss.papaki.repository.plugins.DefaultAnnotationRepository;
-import org.jboss.papaki.repository.spi.ClassAdapter;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.spi.TypeInfoFactory;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
 
 import java.io.InputStream;
 
@@ -39,7 +41,6 @@
 public class JavassistAnnotationResourceVisitor extends GenericAnnotationResourceVisitor
 {
    private ClassPool pool;
-   private CtClass ctObject;
 
    public JavassistAnnotationResourceVisitor(DefaultAnnotationRepository repository, ClassPool pool)
    {
@@ -49,16 +50,15 @@
          throw new IllegalArgumentException("Null pool");
 
       this.pool = pool;
-      ctObject = pool.makeClass(Object.class.getName());
    }
 
-   protected boolean isRelevant(ClassAdapter classAdapter)
+   @Override
+   protected TypeInfoFactory createTypeInfoFactory()
    {
-      CtClass ctCA = CtClassAdapter.class.cast(classAdapter).getCtClass();
-      return ctObject.equals(ctCA) == false;
+      return new JavassistTypeInfoFactory();
    }
 
-   protected ClassAdapter createClassAdapter(ResourceContext context) throws Exception
+   protected ClassInfo createClassInfo(ResourceContext context) throws Exception
    {
       InputStream stream = context.getInputStream();
       if (stream == null)
@@ -67,7 +67,7 @@
       try
       {
          CtClass ctClass = pool.makeClass(stream);
-         return new CtClassAdapter(ctClass);
+         return null;
       }
       finally
       {

Modified: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java	2009-10-19 16:28:22 UTC (rev 95129)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java	2009-10-19 18:29:38 UTC (rev 95130)
@@ -26,7 +26,7 @@
 import org.jboss.classloading.spi.visitor.ResourceFilter;
 import org.jboss.classloading.spi.visitor.ResourceVisitor;
 import org.jboss.papaki.repository.plugins.DefaultAnnotationRepository;
-import org.jboss.papaki.repository.plugins.reflection.ReflectionAnnotationResourceVisitor;
+import org.jboss.papaki.repository.plugins.GenericAnnotationResourceVisitor;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 
@@ -79,7 +79,7 @@
 
    protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository, ClassLoader... cls)
    {
-      return new ReflectionAnnotationResourceVisitor(repository);
+      return new GenericAnnotationResourceVisitor(repository);
    }
 
    public void setExcludedRoots(VirtualFile[] excludedRoots)




More information about the jboss-cvs-commits mailing list