diff options
-rw-r--r-- | Readme.html | 2 | ||||
-rw-r--r-- | build.xml | 1 | ||||
-rw-r--r-- | src/main/javassist/bytecode/AccessFlag.java | 3 | ||||
-rw-r--r-- | src/main/javassist/bytecode/AttributeInfo.java | 2 | ||||
-rw-r--r-- | src/test/javassist/JvstTest4.java | 24 |
5 files changed, 30 insertions, 2 deletions
diff --git a/Readme.html b/Readme.html index e896bab5..378bb0f5 100644 --- a/Readme.html +++ b/Readme.html @@ -283,7 +283,7 @@ see javassist.Dump. <p>-version 3.19 <ul> -<li>JIRA JASSIST-158, 205, 206, 207, 211, 212, 216, 223. +<li>JIRA JASSIST-158, 205, 206, 207, 211, 212, 216, 223, 224. </ul> </p> @@ -90,6 +90,7 @@ optimize="off" includes="**"> <classpath refid="test.compile.classpath"/> + <compilerarg value="-parameters" /> </javac> </target> diff --git a/src/main/javassist/bytecode/AccessFlag.java b/src/main/javassist/bytecode/AccessFlag.java index cc445858..736135ec 100644 --- a/src/main/javassist/bytecode/AccessFlag.java +++ b/src/main/javassist/bytecode/AccessFlag.java @@ -18,7 +18,7 @@ package javassist.bytecode; /** * A support class providing static methods and constants - * for access modifiers such as public, rivate, ... + * for access modifiers such as public, private, ... */ public class AccessFlag { public static final int PUBLIC = 0x0001; @@ -38,6 +38,7 @@ public class AccessFlag { public static final int SYNTHETIC = 0x1000; public static final int ANNOTATION = 0x2000; public static final int ENUM = 0x4000; + public static final int MANDATED = 0x8000; public static final int SUPER = 0x0020; diff --git a/src/main/javassist/bytecode/AttributeInfo.java b/src/main/javassist/bytecode/AttributeInfo.java index 2cf878eb..7dee7829 100644 --- a/src/main/javassist/bytecode/AttributeInfo.java +++ b/src/main/javassist/bytecode/AttributeInfo.java @@ -101,6 +101,8 @@ public class AttributeInfo { return new LocalVariableAttribute(cp, name, in); else if (nameStr.equals(LocalVariableTypeAttribute.tag)) return new LocalVariableTypeAttribute(cp, name, in); + else if (nameStr.equals(MethodParametersAttribute.tag)) + return new MethodParametersAttribute(cp, name, in); else if (nameStr.equals(AnnotationsAttribute.visibleTag) || nameStr.equals(AnnotationsAttribute.invisibleTag)) { // RuntimeVisibleAnnotations or RuntimeInvisibleAnnotations 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))); + } } |