diff options
author | chibash <chiba@javassist.org> | 2014-06-09 19:33:43 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2014-06-09 19:33:43 +0900 |
commit | 37b27e12d46d7aedcd7c5c671fc8b895e626b100 (patch) | |
tree | a1d8f2caf2cc11741b00b310d05e10909eecd508 /src/test/javassist/JvstTest4.java | |
parent | 24dc6650e0f53372e71ac5e9ea6300c2fb7bdbc6 (diff) | |
download | javassist-37b27e12d46d7aedcd7c5c671fc8b895e626b100.tar.gz javassist-37b27e12d46d7aedcd7c5c671fc8b895e626b100.zip |
JIRA JASSIST-224
Diffstat (limited to 'src/test/javassist/JvstTest4.java')
-rw-r--r-- | src/test/javassist/JvstTest4.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index 8e60c16a..f8994cd7 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -956,4 +956,28 @@ public class JvstTest4 extends JvstTestRoot { cc.writeFile(); make(cc.getName()); } + + // JIRA JASSIST-224 + public void testMethodParameters() throws Exception { + Class rc = test4.MethodParamTest.class; + java.lang.reflect.Method m = rc.getDeclaredMethods()[0]; + java.lang.reflect.Parameter[] params = m.getParameters(); + assertEquals("i", params[0].getName()); + assertEquals("s", params[1].getName()); + + CtClass cc = sloader.get("test4.MethodParamTest"); + ClassFile cf = cc.getClassFile2(); + ConstPool cp = cf.getConstPool(); + MethodInfo minfo = cf.getMethod("test"); + MethodParametersAttribute attr + = (MethodParametersAttribute)minfo.getAttribute(MethodParametersAttribute.tag); + assertEquals(2, attr.size()); + assertEquals("i", cp.getUtf8Info(attr.name(0))); + assertEquals("s", cp.getUtf8Info(attr.name(1))); + + attr = (MethodParametersAttribute)attr.copy(cp, null); + assertEquals(2, attr.size()); + assertEquals("i", cp.getUtf8Info(attr.name(0))); + assertEquals("s", cp.getUtf8Info(attr.name(1))); + } } |