Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#ASM4
The following examples show how to use
jdk.internal.org.objectweb.asm.Opcodes#ASM4 .
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: ClassNode.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Checks that this class node is compatible with the given ASM API version. * This methods checks that this node, and all its nodes recursively, do not * contain elements that were introduced in more recent versions of the ASM * API than the given version. * * @param api * an ASM API version. Must be one of {@link Opcodes#ASM4} or * {@link Opcodes#ASM5}. */ public void check(final int api) { if (api == Opcodes.ASM4) { if (visibleTypeAnnotations != null && visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleTypeAnnotations != null && invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } for (FieldNode f : fields) { f.check(api); } for (MethodNode m : methods) { m.check(api); } } }
Example 2
Source File: ClassNode.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Checks that this class node is compatible with the given ASM API version. * This methods checks that this node, and all its nodes recursively, do not * contain elements that were introduced in more recent versions of the ASM * API than the given version. * * @param api * an ASM API version. Must be one of {@link Opcodes#ASM4} or * {@link Opcodes#ASM5}. */ public void check(final int api) { if (api == Opcodes.ASM4) { if (visibleTypeAnnotations != null && visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleTypeAnnotations != null && invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } for (FieldNode f : fields) { f.check(api); } for (MethodNode m : methods) { m.check(api); } } }
Example 3
Source File: ScriptClassInfoCollector.java From nashorn 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 4
Source File: ClassNode.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Checks that this class node is compatible with the given ASM API version. * This methods checks that this node, and all its nodes recursively, do not * contain elements that were introduced in more recent versions of the ASM * API than the given version. * * @param api * an ASM API version. Must be one of {@link Opcodes#ASM4} or * {@link Opcodes#ASM5}. */ public void check(final int api) { if (api == Opcodes.ASM4) { if (visibleTypeAnnotations != null && visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleTypeAnnotations != null && invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } for (FieldNode f : fields) { f.check(api); } for (MethodNode m : methods) { m.check(api); } } }
Example 5
Source File: ScriptClassInstrumentor.java From nashorn with GNU General Public License v2.0 | 5 votes |
ScriptClassInstrumentor(final ClassVisitor visitor, final ScriptClassInfo sci) { super(Opcodes.ASM4, visitor); if (sci == null) { throw new IllegalArgumentException("Null ScriptClassInfo, is the class annotated?"); } this.scriptClassInfo = sci; this.memberCount = scriptClassInfo.getInstancePropertyCount(); }
Example 6
Source File: ScriptClassInstrumentor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) { final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess); if (memInfo != null && memInfo.getKind() == Kind.PROPERTY && memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) { // non-instance @Property fields - these have to go elsewhere unless 'static final' return null; } final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value); return new FieldVisitor(Opcodes.ASM4, delegateFV) { @Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore script field annotations return null; } return fv.visitAnnotation(desc, visible); } @Override public void visitAttribute(final Attribute attr) { fv.visitAttribute(attr); } @Override public void visitEnd() { fv.visitEnd(); } }; }
Example 7
Source File: RemappingClassAdapter.java From nashorn with GNU General Public License v2.0 | 4 votes |
public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) { this(Opcodes.ASM4, cv, remapper); }
Example 8
Source File: NullVisitor.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
NullAnnotationVisitor() { super(Opcodes.ASM4); }
Example 9
Source File: NullVisitor.java From nashorn with GNU General Public License v2.0 | 4 votes |
NullAnnotationVisitor() { super(Opcodes.ASM4); }
Example 10
Source File: ScriptClassInfoCollector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
ScriptClassInfoCollector(final ClassVisitor visitor) { super(Opcodes.ASM4, visitor); }
Example 11
Source File: TraceSignatureVisitor.java From nashorn with GNU General Public License v2.0 | 4 votes |
private TraceSignatureVisitor(final StringBuffer buf) { super(Opcodes.ASM4); this.declaration = buf; }
Example 12
Source File: NullVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
NullVisitor() { super(Opcodes.ASM4); }
Example 13
Source File: MethodNode.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Checks that this method node is compatible with the given ASM API * version. This methods checks that this node, and all its nodes * recursively, do not contain elements that were introduced in more recent * versions of the ASM API than the given version. * * @param api * an ASM API version. Must be one of {@link Opcodes#ASM4} or * {@link Opcodes#ASM5}. */ public void check(final int api) { if (api == Opcodes.ASM4) { if (visibleTypeAnnotations != null && visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleTypeAnnotations != null && invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } int n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size(); for (int i = 0; i < n; ++i) { TryCatchBlockNode tcb = tryCatchBlocks.get(i); if (tcb.visibleTypeAnnotations != null && tcb.visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (tcb.invisibleTypeAnnotations != null && tcb.invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } } for (int i = 0; i < instructions.size(); ++i) { AbstractInsnNode insn = instructions.get(i); if (insn.visibleTypeAnnotations != null && insn.visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (insn.invisibleTypeAnnotations != null && insn.invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (insn instanceof MethodInsnNode) { boolean itf = ((MethodInsnNode) insn).itf; if (itf != (insn.opcode == Opcodes.INVOKEINTERFACE)) { throw new RuntimeException(); } } } if (visibleLocalVariableAnnotations != null && visibleLocalVariableAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleLocalVariableAnnotations != null && invisibleLocalVariableAnnotations.size() > 0) { throw new RuntimeException(); } } }
Example 14
Source File: MethodNode.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Checks that this method node is compatible with the given ASM API * version. This methods checks that this node, and all its nodes * recursively, do not contain elements that were introduced in more recent * versions of the ASM API than the given version. * * @param api * an ASM API version. Must be one of {@link Opcodes#ASM4} or * {@link Opcodes#ASM5}. */ public void check(final int api) { if (api == Opcodes.ASM4) { if (visibleTypeAnnotations != null && visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleTypeAnnotations != null && invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } int n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size(); for (int i = 0; i < n; ++i) { TryCatchBlockNode tcb = tryCatchBlocks.get(i); if (tcb.visibleTypeAnnotations != null && tcb.visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (tcb.invisibleTypeAnnotations != null && tcb.invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } } for (int i = 0; i < instructions.size(); ++i) { AbstractInsnNode insn = instructions.get(i); if (insn.visibleTypeAnnotations != null && insn.visibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (insn.invisibleTypeAnnotations != null && insn.invisibleTypeAnnotations.size() > 0) { throw new RuntimeException(); } if (insn instanceof MethodInsnNode) { boolean itf = ((MethodInsnNode) insn).itf; if (itf != (insn.opcode == Opcodes.INVOKEINTERFACE)) { throw new RuntimeException(); } } } if (visibleLocalVariableAnnotations != null && visibleLocalVariableAnnotations.size() > 0) { throw new RuntimeException(); } if (invisibleLocalVariableAnnotations != null && invisibleLocalVariableAnnotations.size() > 0) { throw new RuntimeException(); } } }
Example 15
Source File: SignatureVisitor.java From hottub with GNU General Public License v2.0 | 3 votes |
/** * Constructs a new {@link SignatureVisitor}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. */ public SignatureVisitor(final int api) { if (api != Opcodes.ASM4 && api != Opcodes.ASM5) { throw new IllegalArgumentException(); } this.api = api; }
Example 16
Source File: SignatureVisitor.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
/** * Constructs a new {@link SignatureVisitor}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. */ public SignatureVisitor(final int api) { if (api != Opcodes.ASM4 && api != Opcodes.ASM5) { throw new IllegalArgumentException(); } this.api = api; }
Example 17
Source File: LocalVariablesSorter.java From nashorn with GNU General Public License v2.0 | 3 votes |
/** * Creates a new {@link LocalVariablesSorter}. <i>Subclasses must not use * this constructor</i>. Instead, they must use the * {@link #LocalVariablesSorter(int, int, String, MethodVisitor)} version. * * @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. */ public LocalVariablesSorter( final int access, final String desc, final MethodVisitor mv) { this(Opcodes.ASM4, access, desc, mv); }
Example 18
Source File: SignatureVisitor.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
/** * Constructs a new {@link SignatureVisitor}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. */ public SignatureVisitor(final int api) { if (api != Opcodes.ASM4 && api != Opcodes.ASM5) { throw new IllegalArgumentException(); } this.api = api; }
Example 19
Source File: InstructionAdapter.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Creates a new {@link InstructionAdapter}. <i>Subclasses must not use this * constructor</i>. Instead, they must use the * {@link #InstructionAdapter(int, MethodVisitor)} version. * * @param mv the method visitor to which this adapter delegates calls. */ public InstructionAdapter(final MethodVisitor mv) { this(Opcodes.ASM4, mv); }
Example 20
Source File: SerialVersionUIDAdder.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Creates a new {@link SerialVersionUIDAdder}. <i>Subclasses must not use * this constructor</i>. Instead, they must use the * {@link #SerialVersionUIDAdder(int, ClassVisitor)} version. * * @param cv a {@link ClassVisitor} to which this visitor will delegate * calls. */ public SerialVersionUIDAdder(final ClassVisitor cv) { this(Opcodes.ASM4, cv); }