List of usage examples for org.objectweb.asm Opcodes ASM4
int ASM4
To view the source code for org.objectweb.asm Opcodes ASM4.
Click Source Link
From source file:org.openjdk.jmh.generators.asm.ASMFieldInfo.java
License:Open Source License
public ASMFieldInfo(FieldVisitor fieldVisitor, ASMClassInfo declaringClass, int access, String name, ClassInfo type) {// w w w . ja v a2 s . c om super(Opcodes.ASM4, fieldVisitor); this.declaringClass = declaringClass; this.access = access; this.name = name; this.type = type; this.annotations = new HashMap<>(); }
From source file:org.openjdk.jmh.generators.asm.ASMMethodInfo.java
License:Open Source License
public ASMMethodInfo(MethodVisitor methodVisitor, ClassInfoRepo repo, ASMClassInfo declaringClass, int access, String name, String desc, String signature) { super(Opcodes.ASM4, methodVisitor); this.declaringClass = declaringClass; this.repo = repo; this.access = access; this.name = name; this.returnType = Type.getReturnType(desc).getClassName(); this.annotations = new HashMap<>(); this.argumentTypes = Type.getArgumentTypes(desc); }
From source file:org.rascalmpl.library.lang.java.m3.internal.JarConverter.java
License:Open Source License
private void insertDeclMethod(String type, String signature, String desc, String name, int access) throws URISyntaxException { String sig;/*from ww w . j av a 2 s . c om*/ if (signature != null) { sig = extractSignature(signature); // TypeVariables SignatureReader sr = new SignatureReader(signature); sr.accept(new SigVisitor(Opcodes.ASM4)); } else { sig = extractSignature(desc); } // Typedepency methods String TypeSig = sig; // Loop over all parameters in the signature String[] params; if ((TypeSig != null) && (!TypeSig.equals(""))) { params = TypeSig.split(","); for (int i = 0; i < params.length; i++) { this.insert(this.typeDependency, values.sourceLocation("java+parameter", "", LogPath + "/" + name + "(" + sig + ")" + "/" + params[i] + i), values.sourceLocation(printParameterType(params[i]), "", params[i])); } } // Return type if (type.equals("java+constructor")) { this.insert(this.typeDependency, values.sourceLocation("java+constructor", "", LogPath + "/" + name + "(" + sig + ")"), values.sourceLocation("java+class", "", LogPath)); } else { String rType = null; if (signature != null) { rType = Signature.toString(signature); } else { rType = Signature.toString(desc); } rType = rType.substring(0, rType.indexOf(' ')); this.insert(this.typeDependency, values.sourceLocation("java+method", "", LogPath + "/" + name + "(" + sig + ")"), values.sourceLocation(printParameterType(rType), "", rType)); } this.insert(this.declarations, values.sourceLocation(type, "", LogPath + "/" + name + "(" + sig + ")"), values.sourceLocation(jarFile + "!" + ClassFile)); for (int fs = 0; fs < 15; fs++) { if ((access & (0x0001 << fs)) != 0) { this.insert(this.modifiers, values.sourceLocation(type, "", LogPath + "/" + name + "(" + sig + ")"), mapFieldAccesCode(0x0001 << fs, METHODE)); } } // Containment of methods. this.insert(this.containment, values.sourceLocation(classScheme, "", LogPath), values.sourceLocation(type, "", LogPath + "/" + name + "(" + sig + ")")); // Deprecated method emit type annotation dependency Deprecated. if ((access & 0x20000) == 0x20000) this.insert(this.annotations, values.sourceLocation("java+method", "", LogPath + "/" + name + "(" + sig + ")"), values.sourceLocation("java+interface", "", "/java/lang/Deprecated")); // <|java+method:///Main/Main/FindMe(java.lang.String)|,|java+interface:///java/lang/Deprecated|>, }
From source file:org.spockframework.buildsupport.EmptyAnnotationVisitor.java
License:Apache License
public EmptyAnnotationVisitor() { super(Opcodes.ASM4); }
From source file:org.spockframework.buildsupport.SpecClassFileVisitor.java
License:Apache License
SpecClassFileVisitor() {
super(Opcodes.ASM4);
}
From source file:org.spongepowered.mod.asm.transformers.EventTransformer.java
License:MIT License
protected static MethodNode createGetGameMethod() { MethodNode methodNode = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, "getGame", "()Lorg/spongepowered/api/Game;", null, null); methodNode.instructions.add(new FieldInsnNode(Opcodes.GETSTATIC, "org/spongepowered/mod/SpongeMod", "instance", "Lorg/spongepowered/mod/SpongeMod;")); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "org/spongepowered/mod/SpongeMod", "getGame", "()Lorg/spongepowered/mod/SpongeGame;", false)); methodNode.instructions.add(new InsnNode(Opcodes.ARETURN)); methodNode.maxLocals = 1;//from w w w.jav a2 s .c om methodNode.maxStack = 1; return methodNode; }
From source file:org.spongepowered.mod.asm.transformers.EventTransformer.java
License:MIT License
protected static MethodNode createGetSimpleNameMethod() { MethodNode methodNode = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, "getSimpleName", "()Ljava/lang/String;", null, null); methodNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false)); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Class", "getSimpleName", "()Ljava/lang/String;", false)); methodNode.instructions.add(new InsnNode(Opcodes.ARETURN)); methodNode.maxLocals = 1;/* ww w. java 2 s . co m*/ methodNode.maxStack = 1; return methodNode; }
From source file:org.spongepowered.mod.asm.transformers.EventTransformer.java
License:MIT License
protected static MethodNode createIsCancellableMethod() { MethodNode methodNode = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, "isCancellable", "()Z", null, null);/*w w w .j av a 2 s. com*/ methodNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "net/minecraftforge/fml/common/eventhandler/Event", "isCancelable", "()Z", false)); methodNode.instructions.add(new InsnNode(Opcodes.IRETURN)); methodNode.maxLocals = 1; methodNode.maxStack = 1; return methodNode; }
From source file:org.spongepowered.mod.asm.transformers.EventTransformer.java
License:MIT License
protected static MethodNode createIsCancelledMethod() { MethodNode methodNode = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, "isCancelled", "()Z", null, null); methodNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "net/minecraftforge/fml/common/eventhandler/Event", "isCanceled", "()Z", false)); methodNode.instructions.add(new InsnNode(Opcodes.IRETURN)); methodNode.maxLocals = 1;//w w w . j a v a 2s . c om methodNode.maxStack = 1; return methodNode; }
From source file:org.spongepowered.mod.asm.transformers.EventTransformer.java
License:MIT License
protected static MethodNode createSetCancelledMethod() { MethodNode methodNode = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, "setCancelled", "(Z)V", null, null);/*from w ww . j av a 2 s . c om*/ methodNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); methodNode.instructions.add(new VarInsnNode(Opcodes.ILOAD, 1)); methodNode.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "net/minecraftforge/fml/common/eventhandler/Event", "setCanceled", "(Z)V", false)); methodNode.instructions.add(new InsnNode(Opcodes.RETURN)); methodNode.maxLocals = 1; methodNode.maxStack = 1; return methodNode; }