/** * Visits an annotation of a parameter this method. * * @param parameter the parameter index. This index must be strictly smaller than the number of * parameters in the method descriptor, and strictly smaller than the parameter count * specified in {@link #visitAnnotableParameterCount}. Important note: <i>a parameter index i * is not required to correspond to the i'th parameter descriptor in the method * descriptor</i>, in particular in case of synthetic parameters (see * https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18). * @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 visitParameterAnnotation( final int parameter, final String descriptor, final boolean visible) { if (mv != null) { return mv.visitParameterAnnotation(parameter, descriptor, visible); } return null; }
public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { return AnnotationVisitorTee.getInstance(mv1.visitParameterAnnotation(parameter, desc, visible), mv2.visitParameterAnnotation(parameter, desc, visible)); }
public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { return AnnotationVisitorTee.getInstance(mv1.visitParameterAnnotation(parameter, desc, visible), mv2.visitParameterAnnotation(parameter, desc, visible)); }
public static void acceptParameter(DexAnnotationNode ann, int index, MethodVisitor v) { AnnotationVisitor av = v.visitParameterAnnotation(index, ann.type, ann.visibility != Visibility.BUILD); if (av != null) { accept(ann.items, av); av.visitEnd(); } }
an.accept(mv.visitParameterAnnotation(i, an.desc, true)); an.accept(mv.visitParameterAnnotation(i, an.desc, false));
methodVisitor.visitParameterAnnotation(i, annotationDescriptor, visible), currentOffset, /* named = */ true,
AnnotationVisitor av = mv.visitParameterAnnotation(j, at.getType(), (va.getVisibility() == AnnotationConstants.RUNTIME_VISIBLE)); generateAnnotationElems(av, at.getElems(), true);
@Override public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { desc = processDescriptor(sourceType, desc); return super.visitParameterAnnotation(parameter, desc, visible); }
AnnotationVisitor interceptorTypeAnn = constructorWriter.visitParameterAnnotation( interceptorArgumentIndex, Type.getDescriptor(io.micronaut.context.annotation.Type.class), true ).visitArray("value");
private static void addOnAfterMethodTimerOnly(ClassWriter cw) { MethodVisitor mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "onAfter", "(Lorg/glowroot/agent/plugin/api/Timer;)V", null, null); visitAnnotation(mv, "Lorg/glowroot/agent/plugin/api/weaving/OnAfter;"); checkNotNull(mv.visitParameterAnnotation(0, "Lorg/glowroot/agent/plugin/api/weaving/BindTraveler;", true)).visitEnd(); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEINTERFACE, "org/glowroot/agent/plugin/api/Timer", "stop", "()V", true); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); }
private void addOnThrowMethod(ClassWriter cw) { MethodVisitor mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "onThrow", "(Ljava/lang/Throwable;Lorg/glowroot/agent/plugin/api/TraceEntry;)V", null, null); visitAnnotation(mv, "Lorg/glowroot/agent/plugin/api/weaving/OnThrow;"); checkNotNull(mv.visitParameterAnnotation(0, "Lorg/glowroot/agent/plugin/api/weaving/BindThrowable;", true)).visitEnd(); checkNotNull(mv.visitParameterAnnotation(1, "Lorg/glowroot/agent/plugin/api/weaving/BindTraveler;", true)).visitEnd(); mv.visitCode(); if (!config.traceEntryEnabledProperty().isEmpty()) { mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitInsn(RETURN); mv.visitLabel(l0); } mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEINTERFACE, "org/glowroot/agent/plugin/api/TraceEntry", "endWithError", "(Ljava/lang/Throwable;)V", true); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); }
visitAnnotation(mv, "Lorg/glowroot/agent/plugin/api/weaving/OnBefore;"); if (methodMetaInternalName != null) { checkNotNull(mv.visitParameterAnnotation(1, "Lorg/glowroot/agent/plugin/api/weaving/BindReceiver;", true)).visitEnd(); checkNotNull(mv.visitParameterAnnotation(2, "Lorg/glowroot/agent/plugin/api/weaving/BindMethodName;", true)).visitEnd(); checkNotNull(mv.visitParameterAnnotation(3, "Lorg/glowroot/agent/plugin/api/weaving/BindParameterArray;", true)).visitEnd(); checkNotNull(mv.visitParameterAnnotation(4, "Lorg/glowroot/agent/plugin/api/weaving/BindMethodMeta;", true)).visitEnd();
@Test public void shouldForwardVisitParameterAnnotationToChild() { getTesteeVisitor().visitParameterAnnotation(1, "foo", false); verify(this.mv).visitParameterAnnotation(1, "foo", false); }
"(Lorg/glowroot/agent/plugin/api/weaving/OptionalReturn;" + travelerType + ")V", null, null); checkNotNull(mv.visitParameterAnnotation(0, "Lorg/glowroot/agent/plugin/api/weaving/BindOptionalReturn;", true)).visitEnd(); checkNotNull(mv.visitParameterAnnotation(1, "Lorg/glowroot/agent/plugin/api/weaving/BindTraveler;", true)).visitEnd(); int travelerParamIndex = 1;
/** {@inheritDoc} */ @Override public AnnotationVisitor visitParameterAnnotation(int arg0, String arg1, boolean arg2) { mv1.visitParameterAnnotation(arg0, arg1, arg2); return mv2.visitParameterAnnotation(arg0, arg1, arg2); }
@Override public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { // Memorize all visible annotations for each parameter. // It needs to store in a Multimap because there can be multiple annotations per parameter. if (visible) { AnnotationNode annotationNode = new AnnotationNode(Opcodes.ASM5, desc); paramAnnotations.put(parameter, annotationNode); return annotationNode; } return super.visitParameterAnnotation(parameter, desc, visible); }
private void addWebParamAnnotation(MethodVisitor mv, int index, String paramName) { AnnotationVisitor av = mv.visitParameterAnnotation(index, Type.getDescriptor(WebParam.class), true); av.visit("name", paramName); av.visitEnd(); } }
@Override public AnnotationVisitor visitParameterAnnotation( final int parameter, final String descriptor, final boolean visible) { AnnotationVisitor annotationVisitor = super.visitParameterAnnotation(parameter, remapper.mapDesc(descriptor), visible); return annotationVisitor == null ? annotationVisitor : new AnnotationRemapper(api, annotationVisitor, remapper); }
@Override public AnnotationVisitor visitParameterAnnotation(final int parameter, final String desc, final boolean visible) { Printer p = this.p.visitParameterAnnotation(parameter, desc, visible); AnnotationVisitor av = mv == null ? null : mv.visitParameterAnnotation( parameter, desc, visible); return new TraceAnnotationVisitor(av, p); }
@Override public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { ParameterAnnotationMember ann = new ParameterAnnotationMember(desc, visible, parameter); methodMember.addParameterAnnotation(ann); return new SortingAnnotationVisitor(ann, super.visitParameterAnnotation(parameter, desc, visible)); } };