/** * Returns the argument types of the method described by this object. * * @return the argument types of the method described by this object. */ public Type[] getArgumentTypes() { return Type.getArgumentTypes(desc); }
/** * 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()); }
/** * 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 @SuppressWarnings("unchecked") public AnnotationVisitor visitParameterAnnotation(final int parameter, final String desc, final boolean visible) { AnnotationNode an = new AnnotationNode(desc); if (visible) { if (visibleParameterAnnotations == null) { int params = Type.getArgumentTypes(this.desc).length; visibleParameterAnnotations = (List<AnnotationNode>[]) new List<?>[params]; } if (visibleParameterAnnotations[parameter] == null) { visibleParameterAnnotations[parameter] = new ArrayList<AnnotationNode>( 1); } visibleParameterAnnotations[parameter].add(an); } else { if (invisibleParameterAnnotations == null) { int params = Type.getArgumentTypes(this.desc).length; invisibleParameterAnnotations = (List<AnnotationNode>[]) new List<?>[params]; } if (invisibleParameterAnnotations[parameter] == null) { invisibleParameterAnnotations[parameter] = new ArrayList<AnnotationNode>( 1); } invisibleParameterAnnotations[parameter].add(an); } return an; }
/** * Creates a new {@link LocalVariablesSorter}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. * @param access * access flags of the adapted method. * @param desc * the method's descriptor (see {@link Type Type}). * @param mv * the method visitor to which this adapter delegates calls. */ protected LocalVariablesSorter(final int api, final int access, final String desc, final MethodVisitor mv) { super(api, mv); Type[] args = Type.getArgumentTypes(desc); nextLocal = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0; for (int i = 0; i < args.length; i++) { nextLocal += args[i].getSize(); } firstLocal = nextLocal; }
/** * Creates a new {@link GeneratorAdapter}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. * @param mv * the method visitor to which this adapter delegates calls. * @param access * the method's access flags (see {@link Opcodes}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ protected GeneratorAdapter(final int api, final MethodVisitor mv, final int access, final String name, final String desc) { super(api, access, desc, mv); this.access = access; this.returnType = Type.getReturnType(desc); this.argumentTypes = Type.getArgumentTypes(desc); }
public String mapMethodDesc(String desc) { if ("()V".equals(desc)) { return desc; } Type[] args = Type.getArgumentTypes(desc); StringBuilder sb = new StringBuilder("("); for (int i = 0; i < args.length; i++) { sb.append(mapDesc(args[i].getDescriptor())); } Type returnType = Type.getReturnType(desc); if (returnType == Type.VOID_TYPE) { sb.append(")V"); return sb.toString(); } sb.append(')').append(mapDesc(returnType.getDescriptor())); return sb.toString(); }
Type[] types = Type.getArgumentTypes(desc); for (int i = 0; i < types.length; ++i) { Type type = types[i];
private void pop(final String desc) { char c = desc.charAt(0); if (c == '(') { int n = 0; Type[] types = Type.getArgumentTypes(desc); for (int i = 0; i < types.length; ++i) { n += types[i].getSize(); } pop(n); } else if (c == 'J' || c == 'D') { pop(2); } else { pop(1); } }
@Override public AnnotationVisitor visitParameterAnnotation(final int parameter, final String desc, final boolean visible) { ByteVector bv = new ByteVector(); if ("Ljava/lang/Synthetic;".equals(desc)) { // workaround for a bug in javac with synthetic parameters // see ClassReader.readParameterAnnotations synthetics = Math.max(synthetics, parameter + 1); return new AnnotationWriter(cw, false, bv, null, 0); } // write type, and reserve space for values count bv.putShort(cw.newUTF8(desc)).putShort(0); AnnotationWriter aw = new AnnotationWriter(cw, true, bv, bv, 2); if (visible) { if (panns == null) { panns = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } aw.next = panns[parameter]; panns[parameter] = aw; } else { if (ipanns == null) { ipanns = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } aw.next = ipanns[parameter]; ipanns[parameter] = aw; } return aw; }
public AnnotationVisitor visitParameterAnnotation( final int parameter, final String desc, final boolean visible) { ByteVector bv = new ByteVector(); // write type, and reserve space for values count bv.putShort(cw.newUTF8(desc)).putShort(0); AnnotationWriter aw = new AnnotationWriter(cw, true, bv, bv, 2); if (visible) { if (panns == null) { panns = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } aw.next = panns[parameter]; panns[parameter] = aw; } else { if (ipanns == null) { ipanns = new AnnotationWriter[Type.getArgumentTypes(descriptor).length]; } aw.next = ipanns[parameter]; ipanns[parameter] = aw; } return aw; }
@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]); } }
Type[] args = Type.getArgumentTypes(desc); while (i < values.size()) { BasicValue expected = newValue(args[j++]);
for (Type argumentType : Type.getArgumentTypes(descriptor)) { int abstractType = getAbstractTypeFromDescriptor(symbolTable, argumentType.getDescriptor(), 0);
int synthetics = Type.getArgumentTypes(context.desc).length - n; AnnotationVisitor av; for (i = 0; i < synthetics; ++i) {
@Override public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) { mv.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs); if (constructor) { Type[] types = Type.getArgumentTypes(desc); for (int i = 0; i < types.length; i++) { popValue(); if (types[i].getSize() == 2) { popValue(); } } Type returnType = Type.getReturnType(desc); if (returnType != Type.VOID_TYPE) { pushValue(OTHER); if (returnType.getSize() == 2) { pushValue(OTHER); } } } }
mv.visitMethodInsn(opcode, owner, name, desc, itf); if (constructor) { Type[] types = Type.getArgumentTypes(desc); for (int i = 0; i < types.length; i++) { popValue();
Frame<V> handler = newFrame(m.maxLocals, m.maxStack); current.setReturn(interpreter.newValue(Type.getReturnType(m.desc))); Type[] args = Type.getArgumentTypes(m.desc); int local = 0; if ((m.access & ACC_STATIC) == 0) {
currentBlock.frame.owner = currentBlock; currentBlock.frame.initInputFrame(cw, access, Type.getArgumentTypes(descriptor), nLocal); visitImplicitFirstFrame(); } else {
Type[] args = Type.getArgumentTypes(descriptor); f.initInputFrame(cw, access, args, this.maxLocals); visitFrame(f);