/** * Returns the argument types of methods of this type. This method should only be used for method * types. * * @return the argument types of methods of this type. */ public Type[] getArgumentTypes() { return getArgumentTypes(getDescriptor()); }
@Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { if (paramExtractor != null) { return null; // method already found, skip all further methods } if (!name.equals(methodName)) { return null; // different method } Type[] argumentTypes = Type.getArgumentTypes(desc); int dwordsCount = 0; for (Type t : argumentTypes) { if (t.getClassName().equals(TYPE_LONG) || t.getClassName().equals(TYPE_DOUBLE)) { dwordsCount++; } } int paramCount = argumentTypes.length; if (paramCount != this.parameterTypes.length) { return null; // different number of params } for (int i = 0; i < argumentTypes.length; i++) { if (!isEqualTypeName(argumentTypes[i], this.parameterTypes[i])) { return null; // wrong param types } } this.paramExtractor = new ParamExtractor((Modifier.isStatic(access) ? 0 : 1), argumentTypes.length + dwordsCount); return paramExtractor; }
@Override public AnnotationVisitor visitParameterAnnotation( final int parameter, final String annotationDescriptor, final boolean visible) { // Create a ByteVector to hold an 'annotation' JVMS structure. // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16. ByteVector annotation = new ByteVector(); // Write type_index and reserve space for num_element_value_pairs. annotation.putShort(symbolTable.addConstantUtf8(annotationDescriptor)).putShort(0); if (visible) { if (lastRuntimeVisibleParameterAnnotations == null) { lastRuntimeVisibleParameterAnnotations = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } return lastRuntimeVisibleParameterAnnotations[parameter] = new AnnotationWriter( symbolTable, annotation, lastRuntimeVisibleParameterAnnotations[parameter]); } else { if (lastRuntimeInvisibleParameterAnnotations == null) { lastRuntimeInvisibleParameterAnnotations = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } return lastRuntimeInvisibleParameterAnnotations[parameter] = new AnnotationWriter( symbolTable, annotation, lastRuntimeInvisibleParameterAnnotations[parameter]); } }
for (Type argumentType : Type.getArgumentTypes(descriptor)) { int abstractType = getAbstractTypeFromDescriptor(symbolTable, argumentType.getDescriptor(), 0);
/** * Returns the argument types of methods of this type. This method should only be used for method * types. * * @return the argument types of methods of this type. */ public Type[] getArgumentTypes() { return getArgumentTypes(getDescriptor()); }
@Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { if (paramExtractor != null) { return null; // method already found, skip all further methods } if (!name.equals(methodName)) { return null; // different method } Type[] argumentTypes = Type.getArgumentTypes(desc); int dwordsCount = 0; for (Type t : argumentTypes) { if (t.getClassName().equals(TYPE_LONG) || t.getClassName().equals(TYPE_DOUBLE)) { dwordsCount++; } } int paramCount = argumentTypes.length; if (paramCount != this.parameterTypes.length) { return null; // different number of params } for (int i = 0; i < argumentTypes.length; i++) { if (!isEqualTypeName(argumentTypes[i], this.parameterTypes[i])) { return null; // wrong param types } } this.paramExtractor = new ParamExtractor((Modifier.isStatic(access) ? 0 : 1), argumentTypes.length + dwordsCount); return paramExtractor; }
@Override public AnnotationVisitor visitParameterAnnotation( final int parameter, final String annotationDescriptor, final boolean visible) { // Create a ByteVector to hold an 'annotation' JVMS structure. // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16. ByteVector annotation = new ByteVector(); // Write type_index and reserve space for num_element_value_pairs. annotation.putShort(symbolTable.addConstantUtf8(annotationDescriptor)).putShort(0); if (visible) { if (lastRuntimeVisibleParameterAnnotations == null) { lastRuntimeVisibleParameterAnnotations = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } return lastRuntimeVisibleParameterAnnotations[parameter] = new AnnotationWriter( symbolTable, annotation, lastRuntimeVisibleParameterAnnotations[parameter]); } else { if (lastRuntimeInvisibleParameterAnnotations == null) { lastRuntimeInvisibleParameterAnnotations = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } return lastRuntimeInvisibleParameterAnnotations[parameter] = new AnnotationWriter( symbolTable, annotation, lastRuntimeInvisibleParameterAnnotations[parameter]); } }
for (Type argumentType : Type.getArgumentTypes(descriptor)) { int abstractType = getAbstractTypeFromDescriptor(symbolTable, argumentType.getDescriptor(), 0);