diff options
author | chibash <chiba@javassist.org> | 2014-11-18 15:43:31 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2014-11-18 15:43:31 +0900 |
commit | a0f4d935a20ffeefcfe4c66730ec702b7fff0928 (patch) | |
tree | 397f4fda3ebba38bc3c83bb29f087a8caf5b4ab2 /src/test/javassist/JvstTest2.java | |
parent | c988383c3921bfd26139c54d6ad4e8f95c48fa0f (diff) | |
download | javassist-a0f4d935a20ffeefcfe4c66730ec702b7fff0928.tar.gz javassist-a0f4d935a20ffeefcfe4c66730ec702b7fff0928.zip |
fixed JASSIST-235. Now CtClass.getEnclosingMethod() is deprecated due to its potential bug.
Diffstat (limited to 'src/test/javassist/JvstTest2.java')
-rw-r--r-- | src/test/javassist/JvstTest2.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest2.java b/src/test/javassist/JvstTest2.java index ad039c8c..411c1e97 100644 --- a/src/test/javassist/JvstTest2.java +++ b/src/test/javassist/JvstTest2.java @@ -523,6 +523,17 @@ public class JvstTest2 extends JvstTestRoot { assertEquals(out, inner.getEnclosingMethod().getDeclaringClass()); } + + assertNull(out.getEnclosingMethod()); + assertNull(out.getEnclosingBehavior()); + + CtClass inner2 = sloader.get("test2.Anon$Anon2$1"); + assertTrue(inner2.getEnclosingBehavior() instanceof CtConstructor); + assertEquals(sloader.get("test2.Anon$Anon2"), inner2.getEnclosingBehavior().getDeclaringClass()); + CtClass inner3 = sloader.get("test2.Anon$Anon3$1"); + assertTrue(inner3.getEnclosingBehavior() instanceof CtConstructor); + assertTrue(((CtConstructor)inner3.getEnclosingBehavior()).isClassInitializer()); + assertEquals(sloader.get("test2.Anon$Anon3"), inner3.getEnclosingBehavior().getDeclaringClass()); } public void testMethodInInner() throws Exception { |