From: chibash Date: Thu, 30 May 2013 06:49:35 +0000 (+0900) Subject: fixed JASSIST-188 X-Git-Tag: log~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f81b1ae4ed8787cdc19b47a561b4c776f48f9a3b;p=javassist.git fixed JASSIST-188 --- 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.

-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 ClassPath object from the search path. * The detached ClassPath 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)); + } }