diff options
-rw-r--r-- | Readme.html | 2 | ||||
-rw-r--r-- | src/main/javassist/runtime/Desc.java | 3 | ||||
-rw-r--r-- | src/test/javassist/JvstTest4.java | 10 |
3 files changed, 12 insertions, 3 deletions
diff --git a/Readme.html b/Readme.html index 022268c5..af8197f2 100644 --- a/Readme.html +++ b/Readme.html @@ -283,7 +283,7 @@ see javassist.Dump. <p>-version 3.16 <ul> - <li>JIRA JASSIST-126, 127, 144, 145, 146, 147, 149, 150, 152, 153, 155. + <li>JIRA JASSIST-126, 127, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155. <li><code>javassist.bytecode.analysis.ControlFlow</code> was added. </ul> diff --git a/src/main/javassist/runtime/Desc.java b/src/main/javassist/runtime/Desc.java index ee20d059..0b1cef51 100644 --- a/src/main/javassist/runtime/Desc.java +++ b/src/main/javassist/runtime/Desc.java @@ -38,8 +38,7 @@ public class Desc { throws ClassNotFoundException { if (useContextClassLoader) - return Thread.currentThread().getContextClassLoader() - .loadClass(name); + return Class.forName(name, true, Thread.currentThread().getContextClassLoader()); else return Class.forName(name); } diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index a3c47ee1..1f3612d8 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -701,4 +701,14 @@ public class JvstTest4 extends JvstTestRoot { Object obj = make(cc.getName()); assertEquals(1, invoke(obj, "test")); } + + public void testJIRA151() { + // try it using classloader of TestDescForName Desc.useContextClassLoader = false; + assertTrue(javassist.runtime.Desc.getClazz("[Ljava.lang.String;") != null); + //Thread.currentThread().setContextClassLoader(TestDescForName.class.getClassLoader()); + boolean old = javassist.runtime.Desc.useContextClassLoader; + javassist.runtime.Desc.useContextClassLoader = true; + assertTrue(javassist.runtime.Desc.getClazz("[Ljava.lang.String;") != null); + javassist.runtime.Desc.useContextClassLoader = old; + } } |