diff options
author | chibash <chiba@javassist.org> | 2013-05-30 15:49:35 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2013-05-30 15:49:35 +0900 |
commit | f81b1ae4ed8787cdc19b47a561b4c776f48f9a3b (patch) | |
tree | c2dadf6705daaab2b38efa89bb649ad9c5fac821 | |
parent | 82948b782b92e8c1c2b7870e2abc313c298a2609 (diff) | |
download | javassist-f81b1ae4ed8787cdc19b47a561b4c776f48f9a3b.tar.gz javassist-f81b1ae4ed8787cdc19b47a561b4c776f48f9a3b.zip |
fixed JASSIST-188
-rw-r--r-- | Readme.html | 2 | ||||
-rw-r--r-- | src/main/javassist/ClassPool.java | 2 | ||||
-rw-r--r-- | src/main/javassist/compiler/MemberResolver.java | 7 | ||||
-rw-r--r-- | src/test/javassist/JvstTest4.java | 20 |
4 files changed, 27 insertions, 4 deletions
diff --git a/Readme.html b/Readme.html index f6936b0d..b11961e2 100644 --- a/Readme.html +++ b/Readme.html @@ -285,7 +285,7 @@ see javassist.Dump. <ul> <li>The source code repository has been moved to <a href="https://github.com/jboss-javassist/javassist">GitHub</a></li>. -<li>JIRA JASSIST-181, 183, 184, 189, 162, 185, 186, 190, 199. +<li>JIRA JASSIST-181, 183, 184, 189, 162, 185, 186, 188, 190, 195, 199, 201. </ul> <p>-version 3.17.1 on December 3, 2012 diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index 2c467fb2..4804b593 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -936,7 +936,7 @@ public class ClassPool { /** * Detatches the <code>ClassPath</code> object from the search path. * The detached <code>ClassPath</code> object cannot be added - * to the pathagain. + * to the path again. */ public void removeClassPath(ClassPath cp) { source.removeClassPath(cp); diff --git a/src/main/javassist/compiler/MemberResolver.java b/src/main/javassist/compiler/MemberResolver.java index 4ab304fe..f304b034 100644 --- a/src/main/javassist/compiler/MemberResolver.java +++ b/src/main/javassist/compiler/MemberResolver.java @@ -399,7 +399,10 @@ public class MemberResolver implements TokenId { if (found == INVALID) throw new CompileError("no such class: " + name); else if (found != null) - return (CtClass)found; + try { + return classPool.get((String)found); + } + catch (NotFoundException e) {} CtClass cc = null; try { @@ -409,7 +412,7 @@ public class MemberResolver implements TokenId { cc = searchImports(name); } - cache.put(name, cc); + cache.put(name, cc.getName()); return cc; } diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index c7582c34..8bcbf01c 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -875,4 +875,24 @@ public class JvstTest4 extends JvstTestRoot { Object obj = make(cc.getName()); assertEquals(4, invoke(obj, "run")); } + + public void testJIRA188() throws Exception { + CtClass cc = sloader.makeClass("test4.JIRA188"); + CtField f = new CtField(CtClass.intType, "f", cc); + f.setModifiers(Modifier.PRIVATE); + cc.addField(f); + cc.addMethod(CtNewMethod.make( + "public int getf(test4.JIRA188 p){ return p.f; }", cc)); + cc.detach(); + // System.gc(); + try { + cc = sloader.get("test4.JIRA188"); + fail("test4.JIRA188 found"); + } + catch (NotFoundException e) {} + cc = sloader.makeClass("test4.JIRA188"); + cc.addField(new CtField(CtClass.intType, "g", cc)); + cc.addMethod(CtNewMethod.make( + "public int getf(test4.JIRA188 p){ return p.g; }", cc)); + } } |