@Test public void testGetNumberArguments() { assertEquals(0, PreorderVisitor.getNumberArguments("()V")); assertEquals(0, PreorderVisitor.getNumberArguments("()I")); assertEquals(0, PreorderVisitor.getNumberArguments("()J")); assertEquals(1, PreorderVisitor.getNumberArguments("(I)V")); assertEquals(1, PreorderVisitor.getNumberArguments("(I)I")); assertEquals(1, PreorderVisitor.getNumberArguments("(J)I")); assertEquals(1, PreorderVisitor.getNumberArguments("([J)I")); assertEquals(1, PreorderVisitor.getNumberArguments("([Ljava/lang/String;)I")); assertEquals(3, PreorderVisitor.getNumberArguments("(J[Ljava/lang/String;J)I")); }
public static int getNumberArguments(String signature) { int count = 0; int pos = 1; boolean inArray = false; while (true) { switch (signature.charAt(pos++)) { case ')': return count; case '[': if (!inArray) { count++; } inArray = true; break; case 'L': if (!inArray) { count++; } while (signature.charAt(pos) != ';') { pos++; } pos++; inArray = false; break; default: if (!inArray) { count++; } inArray = false; break; } } }
PreorderVisitor extends BetterVisitor { public static int getNumberArguments(String signature) { int count = 0; int pos = 1; boolean inArray = false; while (true) { switch (signature.charAt(pos++)) { case ')': return count; case '[': if (!inArray) { count++; } inArray = true; break; case 'L': if (!inArray) { count++; } while (signature.charAt(pos) != ';') { pos++; } pos++; inArray = false; break; default: if (!inArray) { count++; } inArray = false; break; } } } }
PreorderVisitor extends BetterVisitor { public static int getNumberArguments(String signature) { int count = 0; int pos = 1; boolean inArray = false; while (true) { switch (signature.charAt(pos++)) { case ')': return count; case '[': if (!inArray) { count++; } inArray = true; break; case 'L': if (!inArray) { count++; } while (signature.charAt(pos) != ';') { pos++; } pos++; inArray = false; break; default: if (!inArray) { count++; } inArray = false; break; } } }  }
PreorderVisitor extends BetterVisitor { public static int getNumberArguments(String signature) { int count = 0; int pos = 1; boolean inArray = false; while (true) { switch (signature.charAt(pos++)) { case ')': return count; case '[': if (!inArray) { count++; } inArray = true; break; case 'L': if (!inArray) { count++; } while (signature.charAt(pos) != ';') { pos++; } pos++; inArray = false; break; default: if (!inArray) { count++; } inArray = false; break; } } }  Code getCode(); Set<String> getSurroundingCaughtExceptions(int pc); Set<String> getSurroundingCaughtExceptions(int pc, int maxTryBlockSize); int getSizeOfSurroundingTryBlock(int pc); int getSizeOfSurroundingTryBlock(String vmNameOfExceptionClass, int pc); CodeException getSurroundingTryBlock(int pc); CodeException getSurroundingTryBlock(String vmNameOfExceptionClass, int pc); @Override void visitCode(Code obj); void visitAfter(Code obj); @Override void visitConstantPool(ConstantPool obj); void doVisitMethod(Method method); boolean amVisitingMainMethod(); @Override void visitInnerClasses(InnerClasses obj); void visitAfter(JavaClass obj); boolean shouldVisit(JavaClass obj); @Override void visitJavaClass(JavaClass obj); void setupVisitorForClass(JavaClass obj); @Override void visitLineNumberTable(LineNumberTable obj); @Override void visitLocalVariableTable(LocalVariableTable obj); XClass getXClass(); ClassDescriptor getClassDescriptor(); XMethod getXMethod(); MethodDescriptor getMethodDescriptor(); XField getXField(); FieldDescriptor getFieldDescriptor(); ConstantPool getConstantPool(); @SlashedClassName String getClassName(); @DottedClassName String getDottedClassName(); String getPackageName(); String getSourceFile(); @SlashedClassName String getSuperclassName(); @DottedClassName String getDottedSuperclassName(); JavaClass getThisClass(); String getFullyQualifiedMethodName(); boolean visitingMethod(); boolean visitingField(); Field getField(); Method getMethod(); String getMethodName(); static int getNumberArguments(String signature); static boolean hasInterestingMethod(ConstantPool cp, Collection<MethodDescriptor> methods); static boolean hasInterestingClass(ConstantPool cp, Collection<String> classes); int getNumberMethodArguments(); String getMethodSig(); String getDottedMethodSig(); String getFieldName(); String getFieldSig(); boolean getFieldIsStatic(); String getFullyQualifiedFieldName(); @Deprecated String getDottedFieldSig(); @Override String toString(); @Override void visitAnnotation(Annotations arg0); @Override void visitAnnotationDefault(AnnotationDefault arg0); @Override void visitAnnotationEntry(AnnotationEntry arg0); @Override void visitEnclosingMethod(EnclosingMethod arg0); @Override void visitParameterAnnotation(ParameterAnnotations arg0); @Override void visitStackMap(StackMap arg0); @Override void visitStackMapEntry(StackMapEntry arg0); @Override void visitConstantInvokeDynamic(ConstantInvokeDynamic obj); @Override void visitBootstrapMethods(BootstrapMethods obj); @Override void visitMethodParameters(MethodParameters obj); @Override void visitConstantMethodType(ConstantMethodType obj); @Override void visitConstantMethodHandle(ConstantMethodHandle obj); @Override void visitParameterAnnotationEntry(ParameterAnnotationEntry obj); @Override void visitConstantModule(ConstantModule obj); @Override void visitConstantPackage(ConstantPackage obj); }
PreorderVisitor extends BetterVisitor { public static int getNumberArguments(String signature) { int count = 0; int pos = 1; boolean inArray = false; while (true) { switch (signature.charAt(pos++)) { case ')': return count; case '[': if (!inArray) { count++; } inArray = true; break; case 'L': if (!inArray) { count++; } while (signature.charAt(pos) != ';') { pos++; } pos++; inArray = false; break; default: if (!inArray) { count++; } inArray = false; break; } } }  Code getCode(); Set<String> getSurroundingCaughtExceptions(int pc); Set<String> getSurroundingCaughtExceptions(int pc, int maxTryBlockSize); int getSizeOfSurroundingTryBlock(int pc); int getSizeOfSurroundingTryBlock(String vmNameOfExceptionClass, int pc); CodeException getSurroundingTryBlock(int pc); CodeException getSurroundingTryBlock(String vmNameOfExceptionClass, int pc); @Override void visitCode(Code obj); void visitAfter(Code obj); @Override void visitConstantPool(ConstantPool obj); void doVisitMethod(Method method); boolean amVisitingMainMethod(); @Override void visitInnerClasses(InnerClasses obj); void visitAfter(JavaClass obj); boolean shouldVisit(JavaClass obj); @Override void visitJavaClass(JavaClass obj); void setupVisitorForClass(JavaClass obj); @Override void visitLineNumberTable(LineNumberTable obj); @Override void visitLocalVariableTable(LocalVariableTable obj); XClass getXClass(); ClassDescriptor getClassDescriptor(); XMethod getXMethod(); MethodDescriptor getMethodDescriptor(); XField getXField(); FieldDescriptor getFieldDescriptor(); ConstantPool getConstantPool(); @SlashedClassName String getClassName(); @DottedClassName String getDottedClassName(); String getPackageName(); String getSourceFile(); @SlashedClassName String getSuperclassName(); @DottedClassName String getDottedSuperclassName(); JavaClass getThisClass(); String getFullyQualifiedMethodName(); boolean visitingMethod(); boolean visitingField(); Field getField(); Method getMethod(); String getMethodName(); static int getNumberArguments(String signature); static boolean hasInterestingMethod(ConstantPool cp, Collection<MethodDescriptor> methods); static boolean hasInterestingClass(ConstantPool cp, Collection<String> classes); int getNumberMethodArguments(); String getMethodSig(); String getDottedMethodSig(); String getFieldName(); String getFieldSig(); boolean getFieldIsStatic(); String getFullyQualifiedFieldName(); @Deprecated String getDottedFieldSig(); @Override String toString(); @Override void visitAnnotation(Annotations arg0); @Override void visitAnnotationDefault(AnnotationDefault arg0); @Override void visitAnnotationEntry(AnnotationEntry arg0); @Override void visitEnclosingMethod(EnclosingMethod arg0); @Override void visitParameterAnnotation(ParameterAnnotations arg0); @Override void visitStackMap(StackMap arg0); @Override void visitStackMapEntry(StackMapEntry arg0); @Override void visitConstantInvokeDynamic(ConstantInvokeDynamic obj); @Override void visitBootstrapMethods(BootstrapMethods obj); @Override void visitMethodParameters(MethodParameters obj); @Override void visitConstantMethodType(ConstantMethodType obj); @Override void visitConstantMethodHandle(ConstantMethodHandle obj); @Override void visitParameterAnnotationEntry(ParameterAnnotationEntry obj); @Override void visitConstantModule(ConstantModule obj); @Override void visitConstantPackage(ConstantPackage obj);  }