[jboss-cvs] JBossAS SVN: r94792 - projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 13 16:34:23 EDT 2009
Author: flavia.rainone at jboss.com
Date: 2009-10-13 16:34:23 -0400 (Tue, 13 Oct 2009)
New Revision: 94792
Modified:
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistReflectionFactory.java
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
Log:
[JBREFLECT-58] JavassistTypeInfoFactoryImpl now has a configurable classpool factory.
Modified: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistReflectionFactory.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistReflectionFactory.java 2009-10-13 20:26:15 UTC (rev 94791)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistReflectionFactory.java 2009-10-13 20:34:23 UTC (rev 94792)
@@ -80,7 +80,7 @@
public JavassistMethod createMethod(CtMethod ctMethod) throws Throwable
{
//TODO JBREFLECT-58: Fix this to use a more reasonable factory
- ClassPool pool = JavassistTypeInfoFactoryImpl.poolFactory.getPoolForLoader(null);
+ ClassPool pool = JavassistTypeInfoFactoryImpl.getPoolFactory().getPoolForLoader(null);
final CtClass result = pool.makeClass(JavassistMethod.class.getName() + counter.incrementAndGet());
/* TODO JBREFLECT-2 figure out how to do this on all JDKs
try
@@ -262,7 +262,7 @@
public JavassistConstructor createConstructor(CtConstructor ctConstructor) throws Throwable
{
//TODO: FIx this to use a more reasonable factory
- ClassPool pool = JavassistTypeInfoFactoryImpl.poolFactory.getPoolForLoader(null);
+ ClassPool pool = JavassistTypeInfoFactoryImpl.getPoolFactory().getPoolForLoader(null);
final CtClass result = pool.makeClass(JavassistConstructor.class.getName() + counter.incrementAndGet());
try
{
@@ -389,7 +389,7 @@
public JavassistField createField(CtField ctField) throws Throwable
{
// Fix this to use a better pool factory
- ClassPool pool = JavassistTypeInfoFactoryImpl.poolFactory.getPoolForLoader(null);
+ ClassPool pool = JavassistTypeInfoFactoryImpl.getPoolFactory().getPoolForLoader(null);
final CtClass result = pool.makeClass(JavassistField.class.getName() + counter.incrementAndGet());
// TODO JBREFLECT-2
try
Modified: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2009-10-13 20:26:15 UTC (rev 94791)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2009-10-13 20:34:23 UTC (rev 94792)
@@ -257,7 +257,7 @@
for(int i=0; i<parameters.length;i++)
{
typeParams[i] = factory.getTypeInfo(parameters[i],
- JavassistTypeInfoFactoryImpl.poolFactory.getPoolForLoader(null).getClassLoader());
+ JavassistTypeInfoFactoryImpl.getPoolFactory().getPoolForLoader(null).getClassLoader());
}
return getDeclaredConstructor(typeParams);
}
@@ -326,7 +326,7 @@
for(int i=0; i<parameters.length;i++)
{
typeParams[i] = factory.getTypeInfo(parameters[i],
- JavassistTypeInfoFactoryImpl.poolFactory.getPoolForLoader(null).getClassLoader());
+ JavassistTypeInfoFactoryImpl.getPoolFactory().getPoolForLoader(null).getClassLoader());
}
return getDeclaredMethod(methodName, typeParams);
}
Modified: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java 2009-10-13 20:26:15 UTC (rev 94791)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java 2009-10-13 20:34:23 UTC (rev 94792)
@@ -60,8 +60,18 @@
public class JavassistTypeInfoFactoryImpl extends WeakClassCache implements MutableTypeInfoFactory, AnnotationHelper
{
//TODO JBREFLECT-58: Need to change this to a usable CPF.
- static final ClassPoolFactory poolFactory = DefaultClassPoolFactory.getInstance();
+ private static ClassPoolFactory poolFactory = DefaultClassPoolFactory.getInstance();
+ public static ClassPoolFactory getPoolFactory()
+ {
+ return poolFactory;
+ }
+
+ public static void setPoolFactory(ClassPoolFactory classPoolFactory)
+ {
+ poolFactory = classPoolFactory;
+ }
+
static final AnnotationValue[] NO_ANNOTATIONS = new AnnotationValue[0];
/**
* Raise NoClassDefFoundError for javassist not found
More information about the jboss-cvs-commits
mailing list