summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-02-17 14:28:34 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-02-17 14:28:34 +0000
commit1330b1783963dcda4cd4ea0f526464ff6edfbc9a (patch)
tree8c9876785a9e6ef0b392e97aa5730e065dc229df
parentf89063af066d1e9e1fd36229645a565145c8fb5f (diff)
downloadjavassist-1330b1783963dcda4cd4ea0f526464ff6edfbc9a.tar.gz
javassist-1330b1783963dcda4cd4ea0f526464ff6edfbc9a.zip
replaced individual calls to Thread.currentThread().getContextClassLoader() with a call to ClassPool#getContextClassLoader(), which simply forward to Thread.current...
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@249 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-rw-r--r--src/main/javassist/ClassPool.java10
-rw-r--r--src/main/javassist/CtClassType.java5
2 files changed, 12 insertions, 3 deletions
diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java
index b0d8f9e9..25332d76 100644
--- a/src/main/javassist/ClassPool.java
+++ b/src/main/javassist/ClassPool.java
@@ -762,7 +762,15 @@ public class ClassPool {
* @see #toClass(CtClass, java.lang.ClassLoader)
*/
public Class toClass(CtClass clazz) throws CannotCompileException {
- return toClass(clazz, Thread.currentThread().getContextClassLoader());
+ return toClass(clazz, getContextClassLoader());
+ }
+
+ /**
+ * Obtains a class loader that seems appropriate to look up a class
+ * by name.
+ */
+ static ClassLoader getContextClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
}
/**
diff --git a/src/main/javassist/CtClassType.java b/src/main/javassist/CtClassType.java
index d4830676..cf41cc27 100644
--- a/src/main/javassist/CtClassType.java
+++ b/src/main/javassist/CtClassType.java
@@ -411,7 +411,7 @@ class CtClassType extends CtClass {
}
Object[] result = new Object[size1 + size2];
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ ClassLoader cl = ClassPool.getContextClassLoader();
for (int i = 0; i < size1; i++)
result[i] = anno1[i].toAnnotationType(cl, cp);
@@ -434,7 +434,7 @@ class CtClassType extends CtClass {
return new Object[0][];
Object[][] result = new Object[numParameters][];
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ ClassLoader cl = ClassPool.getContextClassLoader();
for (int i = 0; i < numParameters; i++) {
Annotation[] anno1, anno2;
int size1, size2;
@@ -460,6 +460,7 @@ class CtClassType extends CtClass {
result[i] = new Object[size1 + size2];
for (int j = 0; j < size1; ++j)
result[i][j] = anno1[j].toAnnotationType(cl, cp);
+
for (int j = 0; j < size2; ++j)
result[i][j + size1] = anno2[j].toAnnotationType(cl, cp);
}