public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { return AnnotationVisitorTee.getInstance(mv1.visitInsnAnnotation(typeRef, typePath, desc, visible), mv2.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { return AnnotationVisitorTee.getInstance(mv1.visitInsnAnnotation(typeRef, typePath, desc, visible), mv2.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
/** * Visits an annotation on an instruction. This method must be called just <i>after</i> the * annotated instruction. It can be called several times for the same instruction. * * @param typeRef a reference to the annotated type. The sort of this type reference must be * {@link TypeReference#INSTANCEOF}, {@link TypeReference#NEW}, {@link * TypeReference#CONSTRUCTOR_REFERENCE}, {@link TypeReference#METHOD_REFERENCE}, {@link * TypeReference#CAST}, {@link TypeReference#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link * TypeReference#METHOD_INVOCATION_TYPE_ARGUMENT}, {@link * TypeReference#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link * TypeReference#METHOD_REFERENCE_TYPE_ARGUMENT}. See {@link TypeReference}. * @param typePath the path to the annotated type argument, wildcard bound, array element type, or * static inner type within 'typeRef'. May be {@literal null} if the annotation targets * 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not * interested in visiting this annotation. */ public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { if (api < Opcodes.ASM5) { throw new UnsupportedOperationException(REQUIRES_ASM5); } if (mv != null) { return mv.visitInsnAnnotation(typeRef, typePath, descriptor, visible); } return null; }
methodVisitor.visitInsnAnnotation( context.currentTypeAnnotationTarget, context.currentTypeAnnotationTargetPath, methodVisitor.visitInsnAnnotation( context.currentTypeAnnotationTarget, context.currentTypeAnnotationTargetPath,
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { return super.visitInsnAnnotation(typeRef, typePath, desc, visible); }
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { fsmCursor.transition("visitInsnAnnotation"); final AnnotationVisitor annotationVisitor = super.visitInsnAnnotation( typeRef, typePath, desc, visible); return annotationVisitor; // TODO: add CheckAnnotationVisitorFsm }
@Override public void begin(final String name, final Attributes attrs) { String desc = attrs.getValue("desc"); boolean visible = Boolean.valueOf(attrs.getValue("visible")).booleanValue(); int typeRef = Integer.parseInt(attrs.getValue("typeRef")); TypePath typePath = TypePath.fromString(attrs.getValue("typePath")); push(((MethodVisitor) peek()).visitInsnAnnotation(typeRef, typePath, desc, visible)); }
@Override public void begin(final String name, final Attributes attrs) { String desc = attrs.getValue("desc"); boolean visible = Boolean.valueOf(attrs.getValue("visible")) .booleanValue(); int typeRef = Integer.parseInt(attrs.getValue("typeRef")); TypePath typePath = TypePath.fromString(attrs.getValue("typePath")); push(((MethodVisitor) peek()).visitInsnAnnotation(typeRef, typePath, desc, visible)); }
/** * Makes the given visitor visit the annotations of this instruction. * * @param methodVisitor a method visitor. */ protected final void acceptAnnotations(final MethodVisitor methodVisitor) { if (visibleTypeAnnotations != null) { for (int i = 0, n = visibleTypeAnnotations.size(); i < n; ++i) { TypeAnnotationNode typeAnnotation = visibleTypeAnnotations.get(i); typeAnnotation.accept( methodVisitor.visitInsnAnnotation( typeAnnotation.typeRef, typeAnnotation.typePath, typeAnnotation.desc, true)); } } if (invisibleTypeAnnotations != null) { for (int i = 0, n = invisibleTypeAnnotations.size(); i < n; ++i) { TypeAnnotationNode typeAnnotation = invisibleTypeAnnotations.get(i); typeAnnotation.accept( methodVisitor.visitInsnAnnotation( typeAnnotation.typeRef, typeAnnotation.typePath, typeAnnotation.desc, false)); } } }
/** * Makes the given visitor visit the annotations of this instruction. * * @param mv * a method visitor. */ protected final void acceptAnnotations(final MethodVisitor mv) { int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations .size(); for (int i = 0; i < n; ++i) { TypeAnnotationNode an = visibleTypeAnnotations.get(i); an.accept(mv.visitInsnAnnotation(an.typeRef, an.typePath, an.desc, true)); } n = invisibleTypeAnnotations == null ? 0 : invisibleTypeAnnotations .size(); for (int i = 0; i < n; ++i) { TypeAnnotationNode an = invisibleTypeAnnotations.get(i); an.accept(mv.visitInsnAnnotation(an.typeRef, an.typePath, an.desc, false)); } }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { Printer annotationPrinter = p.visitInsnAnnotation(typeRef, typePath, descriptor, visible); return new TraceAnnotationVisitor( super.visitInsnAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter); }
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { AnnotationVisitor av = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(desc), visible); return av == null ? av : new AnnotationRemapper(av, remapper); }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { AnnotationVisitor annotationVisitor = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible); return annotationVisitor == null ? annotationVisitor : new AnnotationRemapper(api, annotationVisitor, remapper); }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { Printer annotationPrinter = p.visitInsnAnnotation(typeRef, typePath, descriptor, visible); return new TraceAnnotationVisitor( super.visitInsnAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter); }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { AnnotationVisitor annotationVisitor = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible); return annotationVisitor == null ? annotationVisitor : new AnnotationRemapper(api, annotationVisitor, remapper); }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { AnnotationVisitor annotationVisitor = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible); return annotationVisitor == null ? annotationVisitor : new AnnotationRemapper(api, annotationVisitor, remapper); }
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { Printer p = this.p .visitInsnAnnotation(typeRef, typePath, desc, visible); AnnotationVisitor av = mv == null ? null : mv.visitInsnAnnotation( typeRef, typePath, desc, visible); return new TraceAnnotationVisitor(av, p); }
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { AnnotationVisitor av = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(desc), visible); return av == null ? av : new AnnotationRemapper(av, remapper); }
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); int sort = new TypeReference(typeRef).getSort(); if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRef(typeRef); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitInsnAnnotation(typeRef, typePath, descriptor, visible)); }