[jboss-cvs] JBossAS SVN: r95136 - in projects/annotations/branches/AnnEnv: core and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 19 15:13:59 EDT 2009
Author: alesj
Date: 2009-10-19 15:13:59 -0400 (Mon, 19 Oct 2009)
New Revision: 95136
Modified:
projects/annotations/branches/AnnEnv/core/pom.xml
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/javassist/JavassistAnnotationResourceVisitor.java
projects/annotations/branches/AnnEnv/pom.xml
Log:
Use the latest Reflect.
Modified: projects/annotations/branches/AnnEnv/core/pom.xml
===================================================================
--- projects/annotations/branches/AnnEnv/core/pom.xml 2009-10-19 19:02:15 UTC (rev 95135)
+++ projects/annotations/branches/AnnEnv/core/pom.xml 2009-10-19 19:13:59 UTC (rev 95136)
@@ -30,6 +30,10 @@
<artifactId>jboss-vfs</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading</artifactId>
</dependency>
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 19:02:15 UTC (rev 95135)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/GenericAnnotationResourceVisitor.java 2009-10-19 19:13:59 UTC (rev 95136)
@@ -73,9 +73,14 @@
return ci.getType().equals(Object.class) == false;
}
+ protected TypeInfo createTypeInfo(ResourceContext context) throws Exception
+ {
+ return typeInfoFactory.getTypeInfo(context.loadClass());
+ }
+
protected ClassInfo createClassInfo(ResourceContext context) throws Exception
{
- TypeInfo typeInfo = typeInfoFactory.getTypeInfo(context.loadClass());
+ TypeInfo typeInfo = createTypeInfo(context);
if (typeInfo instanceof ClassInfo == false)
throw new IllegalArgumentException("Can only handle class info: " + typeInfo);
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 19:02:15 UTC (rev 95135)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/repository/plugins/javassist/JavassistAnnotationResourceVisitor.java 2009-10-19 19:13:59 UTC (rev 95136)
@@ -24,9 +24,12 @@
import org.jboss.classloading.spi.visitor.ResourceContext;
import org.jboss.papaki.repository.plugins.DefaultAnnotationRepository;
import org.jboss.papaki.repository.plugins.GenericAnnotationResourceVisitor;
-import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
+import org.jboss.reflect.plugins.javassist.JavassistUtil;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl;
+import org.jboss.reflect.plugins.javassist.classpool.ClassPoolFactory;
+import org.jboss.reflect.spi.TypeInfo;
import org.jboss.reflect.spi.TypeInfoFactory;
-import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
import java.io.InputStream;
@@ -42,13 +45,14 @@
{
private ClassPool pool;
+ public JavassistAnnotationResourceVisitor(DefaultAnnotationRepository repository)
+ {
+ this(repository, null);
+ }
+
public JavassistAnnotationResourceVisitor(DefaultAnnotationRepository repository, ClassPool pool)
{
super(repository);
-
- if (pool == null)
- throw new IllegalArgumentException("Null pool");
-
this.pool = pool;
}
@@ -58,16 +62,33 @@
return new JavassistTypeInfoFactory();
}
- protected ClassInfo createClassInfo(ResourceContext context) throws Exception
+ protected ClassPool getClassPool(ResourceContext context)
{
+ ClassPool cp = pool;
+ if (cp == null)
+ {
+ ClassPoolFactory factory = JavassistTypeInfoFactoryImpl.getPoolFactory();
+ cp = factory.getPoolForLoader(context.getClassLoader());
+
+ if (cp == null)
+ cp = ClassPool.getDefault();
+ }
+
+ return cp;
+ }
+
+ protected TypeInfo createTypeInfo(ResourceContext context) throws Exception
+ {
+ ClassPool cp = getClassPool(context);
+
InputStream stream = context.getInputStream();
if (stream == null)
throw new IllegalArgumentException("Null stream: " + context);
try
{
- CtClass ctClass = pool.makeClass(stream);
- return null;
+ CtClass ctClass = cp.makeClass(stream);
+ return JavassistUtil.toTypeInfo(ctClass);
}
finally
{
Modified: projects/annotations/branches/AnnEnv/pom.xml
===================================================================
--- projects/annotations/branches/AnnEnv/pom.xml 2009-10-19 19:02:15 UTC (rev 95135)
+++ projects/annotations/branches/AnnEnv/pom.xml 2009-10-19 19:13:59 UTC (rev 95136)
@@ -25,6 +25,7 @@
<properties>
<version.org.jboss.common.core>2.2.16.GA</version.org.jboss.common.core>
<version.org.jboss.vfs>2.1.3.SP1</version.org.jboss.vfs>
+ <version.org.jboss.reflect>2.2.0-SNAPSHOT</version.org.jboss.reflect>
<version.org.jboss.classloader>2.0.7.GA</version.org.jboss.classloader>
<version.javassist>3.11.0.GA</version.javassist>
<version.ant>1.7.1</version.ant>
@@ -102,6 +103,11 @@
<version>${version.org.jboss.vfs}</version>
</dependency>
<dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>${version.org.jboss.reflect}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading</artifactId>
<version>${version.org.jboss.classloader}</version>
More information about the jboss-cvs-commits
mailing list