jdk.internal.org.objectweb.asm.AnnotationVisitor Java Examples
The following examples show how to use
jdk.internal.org.objectweb.asm.AnnotationVisitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NullVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { return new MethodVisitor(Main.ASM_VERSION) { @Override public AnnotationVisitor visitAnnotationDefault() { return new NullAnnotationVisitor(); } @Override public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { return new NullAnnotationVisitor(); } }; }
Example #2
Source File: CheckMethodAdapter.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitParameterAnnotation( final int parameter, final String descriptor, final boolean visible) { checkVisitEndNotCalled(); if ((visible && visibleAnnotableParameterCount > 0 && parameter >= visibleAnnotableParameterCount) || (!visible && invisibleAnnotableParameterCount > 0 && parameter >= invisibleAnnotableParameterCount)) { throw new IllegalArgumentException("Invalid parameter index"); } checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitParameterAnnotation(parameter, descriptor, visible)); }
Example #3
Source File: MethodNode.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { TryCatchBlockNode tcb = tryCatchBlocks.get((typeRef & 0x00FFFF00) >> 8); TypeAnnotationNode an = new TypeAnnotationNode(typeRef, typePath, desc); if (visible) { if (tcb.visibleTypeAnnotations == null) { tcb.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } tcb.visibleTypeAnnotations.add(an); } else { if (tcb.invisibleTypeAnnotations == null) { tcb.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } tcb.invisibleTypeAnnotations.add(an); } return an; }
Example #4
Source File: CheckClassAdapter.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { checkState(); int sort = new TypeReference(typeRef).getSort(); if (sort != TypeReference.CLASS_TYPE_PARAMETER && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND && sort != TypeReference.CLASS_EXTENDS) { throw new IllegalArgumentException( "Invalid type reference sort 0x" + Integer.toHexString(sort)); } checkTypeRef(typeRef); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitTypeAnnotation(typeRef, typePath, descriptor, visible)); }
Example #5
Source File: MethodNode.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { // Finds the last real instruction, i.e. the instruction targeted by // this annotation. AbstractInsnNode insn = instructions.getLast(); while (insn.getOpcode() == -1) { insn = insn.getPrevious(); } // Adds the annotation to this instruction. TypeAnnotationNode an = new TypeAnnotationNode(typeRef, typePath, desc); if (visible) { if (insn.visibleTypeAnnotations == null) { insn.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } insn.visibleTypeAnnotations.add(an); } else { if (insn.invisibleTypeAnnotations == null) { insn.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } insn.invisibleTypeAnnotations.add(an); } return an; }
Example #6
Source File: CheckClassAdapter.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkState(); int sort = typeRef >>> 24; if (sort != TypeReference.CLASS_TYPE_PARAMETER && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND && sort != TypeReference.CLASS_EXTENDS) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitTypeAnnotation(typeRef, typePath, desc, visible)); }
Example #7
Source File: MethodNode.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { TryCatchBlockNode tcb = tryCatchBlocks.get((typeRef & 0x00FFFF00) >> 8); TypeAnnotationNode an = new TypeAnnotationNode(typeRef, typePath, desc); if (visible) { if (tcb.visibleTypeAnnotations == null) { tcb.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } tcb.visibleTypeAnnotations.add(an); } else { if (tcb.invisibleTypeAnnotations == null) { tcb.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } tcb.invisibleTypeAnnotations.add(an); } return an; }
Example #8
Source File: MethodNode.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) { LocalVariableAnnotationNode an = new LocalVariableAnnotationNode( typeRef, typePath, getLabelNodes(start), getLabelNodes(end), index, desc); if (visible) { if (visibleLocalVariableAnnotations == null) { visibleLocalVariableAnnotations = new ArrayList<LocalVariableAnnotationNode>( 1); } visibleLocalVariableAnnotations.add(an); } else { if (invisibleLocalVariableAnnotations == null) { invisibleLocalVariableAnnotations = new ArrayList<LocalVariableAnnotationNode>( 1); } invisibleLocalVariableAnnotations.add(an); } return an; }
Example #9
Source File: FieldNode.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { AnnotationNode an = new AnnotationNode(desc); if (visible) { if (visibleAnnotations == null) { visibleAnnotations = new ArrayList<AnnotationNode>(1); } visibleAnnotations.add(an); } else { if (invisibleAnnotations == null) { invisibleAnnotations = new ArrayList<AnnotationNode>(1); } invisibleAnnotations.add(an); } return an; }
Example #10
Source File: CheckClassAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkState(); int sort = typeRef >>> 24; if (sort != TypeReference.CLASS_TYPE_PARAMETER && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND && sort != TypeReference.CLASS_EXTENDS) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitTypeAnnotation(typeRef, typePath, desc, visible)); }
Example #11
Source File: AnnotationNode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit a given annotation value. * * @param av * an annotation visitor. Maybe <tt>null</tt>. * @param name * the value name. * @param value * the actual value. */ static void accept(final AnnotationVisitor av, final String name, final Object value) { if (av != null) { if (value instanceof String[]) { String[] typeconst = (String[]) value; av.visitEnum(name, typeconst[0], typeconst[1]); } else if (value instanceof AnnotationNode) { AnnotationNode an = (AnnotationNode) value; an.accept(av.visitAnnotation(name, an.desc)); } else if (value instanceof List) { AnnotationVisitor v = av.visitArray(name); if (v != null) { List<?> array = (List<?>) value; for (int j = 0; j < array.size(); ++j) { accept(v, null, array.get(j)); } v.visitEnd(); } } else { av.visit(name, value); } } }
Example #12
Source File: ScriptClassInfoCollector.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { final AnnotationVisitor delegateAV = super.visitAnnotation(desc, visible); if (SCRIPT_CLASS_ANNO_DESC.equals(desc)) { return new AnnotationVisitor(Opcodes.ASM4, delegateAV) { @Override public void visit(final String name, final Object value) { if ("value".equals(name)) { scriptClassName = (String) value; } super.visit(name, value); } }; } return delegateAV; }
Example #13
Source File: MethodNode.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { // Finds the last real instruction, i.e. the instruction targeted by // this annotation. AbstractInsnNode insn = instructions.getLast(); while (insn.getOpcode() == -1) { insn = insn.getPrevious(); } // Adds the annotation to this instruction. TypeAnnotationNode an = new TypeAnnotationNode(typeRef, typePath, desc); if (visible) { if (insn.visibleTypeAnnotations == null) { insn.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } insn.visibleTypeAnnotations.add(an); } else { if (insn.invisibleTypeAnnotations == null) { insn.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } insn.invisibleTypeAnnotations.add(an); } return an; }
Example #14
Source File: MethodNode.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { TryCatchBlockNode tcb = tryCatchBlocks.get((typeRef & 0x00FFFF00) >> 8); TypeAnnotationNode an = new TypeAnnotationNode(typeRef, typePath, desc); if (visible) { if (tcb.visibleTypeAnnotations == null) { tcb.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } tcb.visibleTypeAnnotations.add(an); } else { if (tcb.invisibleTypeAnnotations == null) { tcb.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>( 1); } tcb.invisibleTypeAnnotations.add(an); } return an; }
Example #15
Source File: MethodNode.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitTryCatchAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { TryCatchBlockNode tryCatchBlock = tryCatchBlocks.get((typeRef & 0x00FFFF00) >> 8); TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, typePath, descriptor); if (visible) { if (tryCatchBlock.visibleTypeAnnotations == null) { tryCatchBlock.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } tryCatchBlock.visibleTypeAnnotations.add(typeAnnotation); } else { if (tryCatchBlock.invisibleTypeAnnotations == null) { tryCatchBlock.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } tryCatchBlock.invisibleTypeAnnotations.add(typeAnnotation); } return typeAnnotation; }
Example #16
Source File: CheckClassAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkState(); int sort = typeRef >>> 24; if (sort != TypeReference.CLASS_TYPE_PARAMETER && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND && sort != TypeReference.CLASS_EXTENDS) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitTypeAnnotation(typeRef, typePath, desc, visible)); }
Example #17
Source File: MethodNode.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { TypeAnnotationNode an = new TypeAnnotationNode(typeRef, typePath, desc); if (visible) { if (visibleTypeAnnotations == null) { visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } visibleTypeAnnotations.add(an); } else { if (invisibleTypeAnnotations == null) { invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } invisibleTypeAnnotations.add(an); } return an; }
Example #18
Source File: MethodNode.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { // Find the last real instruction, i.e. the instruction targeted by this annotation. AbstractInsnNode currentInsn = instructions.getLast(); while (currentInsn.getOpcode() == -1) { currentInsn = currentInsn.getPrevious(); } // Add the annotation to this instruction. TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, typePath, descriptor); if (visible) { if (currentInsn.visibleTypeAnnotations == null) { currentInsn.visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } currentInsn.visibleTypeAnnotations.add(typeAnnotation); } else { if (currentInsn.invisibleTypeAnnotations == null) { currentInsn.invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } currentInsn.invisibleTypeAnnotations.add(typeAnnotation); } return typeAnnotation; }
Example #19
Source File: MethodNode.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { AnnotationNode an = new AnnotationNode(desc); if (visible) { if (visibleAnnotations == null) { visibleAnnotations = new ArrayList<AnnotationNode>(1); } visibleAnnotations.add(an); } else { if (invisibleAnnotations == null) { invisibleAnnotations = new ArrayList<AnnotationNode>(1); } invisibleAnnotations.add(an); } return an; }
Example #20
Source File: ClassNode.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, typePath, descriptor); if (visible) { if (visibleTypeAnnotations == null) { visibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } visibleTypeAnnotations.add(typeAnnotation); } else { if (invisibleTypeAnnotations == null) { invisibleTypeAnnotations = new ArrayList<TypeAnnotationNode>(1); } invisibleTypeAnnotations.add(typeAnnotation); } return typeAnnotation; }
Example #21
Source File: MethodNode.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitLocalVariableAnnotation( final int typeRef, final TypePath typePath, final Label[] start, final Label[] end, final int[] index, final String descriptor, final boolean visible) { LocalVariableAnnotationNode localVariableAnnotation = new LocalVariableAnnotationNode( typeRef, typePath, getLabelNodes(start), getLabelNodes(end), index, descriptor); if (visible) { if (visibleLocalVariableAnnotations == null) { visibleLocalVariableAnnotations = new ArrayList<LocalVariableAnnotationNode>(1); } visibleLocalVariableAnnotations.add(localVariableAnnotation); } else { if (invisibleLocalVariableAnnotations == null) { invisibleLocalVariableAnnotations = new ArrayList<LocalVariableAnnotationNode>(1); } invisibleLocalVariableAnnotations.add(localVariableAnnotation); } return localVariableAnnotation; }
Example #22
Source File: MethodNode.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("serial") public AnnotationVisitor visitAnnotationDefault() { return new AnnotationNode(new ArrayList<Object>(0) { @Override public boolean add(final Object o) { annotationDefault = o; return super.add(o); } }); }
Example #23
Source File: RemappingMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) { AnnotationVisitor av = super.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, remapper.mapDesc(desc), visible); return av == null ? av : new RemappingAnnotationAdapter(av, remapper); }
Example #24
Source File: RemappingMethodAdapter.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { AnnotationVisitor annotationVisitor = super.visitAnnotation(remapper.mapDesc(descriptor), visible); return annotationVisitor == null ? annotationVisitor : new RemappingAnnotationAdapter(annotationVisitor, remapper); }
Example #25
Source File: TraceMethodVisitor.java From nashorn with GNU General Public License v2.0 | 5 votes |
@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); }
Example #26
Source File: RemappingMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { AnnotationVisitor av = super.visitTryCatchAnnotation(typeRef, typePath, remapper.mapDesc(desc), visible); return av == null ? av : new RemappingAnnotationAdapter(av, remapper); }
Example #27
Source File: ScriptClassInstrumentor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore @ScriptClass return null; } return super.visitAnnotation(desc, visible); }
Example #28
Source File: CheckMethodAdapter.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitAnnotation( final String desc, final boolean visible) { checkEndMethod(); checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitAnnotation(desc, visible)); }
Example #29
Source File: CheckClassAdapter.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitAnnotation( final String desc, final boolean visible) { checkState(); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitAnnotation(desc, visible)); }
Example #30
Source File: TraceClassVisitor.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { Printer p = this.p.visitClassTypeAnnotation(typeRef, typePath, desc, visible); AnnotationVisitor av = cv == null ? null : cv.visitTypeAnnotation( typeRef, typePath, desc, visible); return new TraceAnnotationVisitor(av, p); }