From a64f57f489c4a60dc20d26b34164991181223f21 Mon Sep 17 00:00:00 2001 From: chibash Date: Wed, 15 Nov 2017 03:46:02 +0900 Subject: adds Modifier#isVarArgs() --- javassist.jar | Bin 759198 -> 759217 bytes src/main/javassist/Modifier.java | 8 ++++++++ src/test/javassist/JvstTest5.java | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/javassist.jar b/javassist.jar index 823d1cc9..9ae3c4bd 100644 Binary files a/javassist.jar and b/javassist.jar differ diff --git a/src/main/javassist/Modifier.java b/src/main/javassist/Modifier.java index 3ee34643..fd73c3b3 100644 --- a/src/main/javassist/Modifier.java +++ b/src/main/javassist/Modifier.java @@ -169,6 +169,14 @@ public class Modifier { return (mod & STRICT) != 0; } + /** + * Returns true if the modifiers include the varargs + * (variable number of arguments) modifier. + */ + public static boolean isVarArgs(int mod) { + return (mod & VARARGS) != 0; + } + /** * Truns the public bit on. The protected and private bits are * cleared. diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java index 346263cb..e7fdb28c 100644 --- a/src/test/javassist/JvstTest5.java +++ b/src/test/javassist/JvstTest5.java @@ -393,4 +393,10 @@ public class JvstTest5 extends JvstTestRoot { private InnerClassesAttribute getInnerClassAttr(CtClass cc) { return (InnerClassesAttribute)cc.getClassFile2().getAttribute(InnerClassesAttribute.tag); } + + public void testVarArgsModifier() throws Exception { + CtClass cc = sloader.get("test5.VarArgsMethod"); + assertTrue(Modifier.isVarArgs(cc.getDeclaredMethod("foo").getModifiers())); + assertFalse(Modifier.isVarArgs(cc.getDeclaredMethod("bar").getModifiers())); + } } -- cgit v1.2.3