org.objectweb.asm.tree.FieldInsnNode Java Examples
The following examples show how to use
org.objectweb.asm.tree.FieldInsnNode.
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: TransformerFieldInjector.java From Diorite with MIT License | 6 votes |
private void trackFieldToInject(FieldInsnNode fieldInsnNode, InsnList insnList) { // check if field is in this same class if (! fieldInsnNode.owner.equals(this.injectTransformer.classNode.name)) { return; } // first check if field is injected TransformerFieldPair fieldPair = this.injectTransformer.getFieldPair(fieldInsnNode); if ((fieldPair == null) || (fieldPair.node == null) || (fieldPair.data == null)) { return; } TransformerInjectTracker injectTracker = TransformerInjectTracker.trackFromField(this.injectTransformer, fieldInsnNode, insnList); fieldPair.placeholderType = injectTracker.getPlaceholderType(); this.injectField(fieldPair, injectTracker); }
Example #2
Source File: SourceInterpreter.java From Cafebabe with GNU General Public License v3.0 | 6 votes |
@Override public SourceValue newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object value = ((LdcInsnNode) insn).cst; size = value instanceof Long || value instanceof Double ? 2 : 1; break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; break; } return new SourceValue(size, insn); }
Example #3
Source File: SourceInterpreter.java From Concurnas with MIT License | 6 votes |
@Override public SourceValue newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object value = ((LdcInsnNode) insn).cst; size = value instanceof Long || value instanceof Double ? 2 : 1; break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; break; } return new SourceValue(size, insn); }
Example #4
Source File: JClassPatcher.java From rscplus with GNU General Public License v3.0 | 6 votes |
/** * TODO: Complete JavaDoc * * @param methodNode * @param owner The class of the variable to be hooked * @param var The variable to be hooked * @param desc * @param newClass The class the hooked variable will be stored in * @param newVar The variable name the hooked variable will be stored in * @param newDesc */ private void hookStaticVariable( MethodNode methodNode, String owner, String var, String desc, String newClass, String newVar, String newDesc) { Iterator<AbstractInsnNode> insnNodeList = methodNode.instructions.iterator(); while (insnNodeList.hasNext()) { AbstractInsnNode insnNode = insnNodeList.next(); int opcode = insnNode.getOpcode(); if (opcode == Opcodes.GETSTATIC || opcode == Opcodes.PUTSTATIC) { FieldInsnNode field = (FieldInsnNode) insnNode; if (field.owner.equals(owner) && field.name.equals(var) && field.desc.equals(desc)) { field.owner = newClass; field.name = newVar; field.desc = newDesc; } } } }
Example #5
Source File: InstructionComparator.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) { if (node1.getOpcode() != node2.getOpcode()) { return false; } switch (node2.getType()) { case VAR_INSN: return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); case TYPE_INSN: return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); case FIELD_INSN: return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); case METHOD_INSN: return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); case LDC_INSN: return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); case IINC_INSN: return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); case INT_INSN: return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); default: return true; } }
Example #6
Source File: InstructionComparator.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) { if (node1.getOpcode() != node2.getOpcode()) { return false; } switch (node2.getType()) { case VAR_INSN: return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); case TYPE_INSN: return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); case FIELD_INSN: return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); case METHOD_INSN: return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); case LDC_INSN: return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); case IINC_INSN: return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); case INT_INSN: return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); default: return true; } }
Example #7
Source File: SourceInterpreter.java From JReFrameworker with MIT License | 6 votes |
@Override public SourceValue unaryOperation(final AbstractInsnNode insn, final SourceValue value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: size = 2; break; case GETFIELD: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; break; } return new SourceValue(size, insn); }
Example #8
Source File: StringObfuscationCipherVMT11.java From zelixkiller with GNU General Public License v3.0 | 6 votes |
private ArrayList<String> findNeededContents(ClassNode cn, MethodNode mn) { ArrayList<String> neededContents = new ArrayList<>(); for (AbstractInsnNode ain : mn.instructions.toArray()) { if (ain instanceof MethodInsnNode) { MethodInsnNode min = (MethodInsnNode) ain; if (min.owner.equals(cn.name) && !neededContents.contains(min.name + min.desc)) { neededContents.add(min.name + min.desc); neededContents.addAll(findNeededContents(cn, ClassUtils.getMethod(cn, min.name, min.desc))); } } if (ain instanceof FieldInsnNode) { FieldInsnNode fin = (FieldInsnNode) ain; if (fin.owner.equals(cn.name) && !neededContents.contains(fin.name + fin.desc)) { neededContents.add(fin.name + fin.desc); } } } return neededContents; }
Example #9
Source File: ConfigureMapReduceAdapter.java From jumbune with GNU Lesser General Public License v3.0 | 6 votes |
/** * This method removes the jumbune mumber from threadLocal signifying that * jumbune doesn't need to log further information. * * @return InsnList list of instructions to be injected */ private InsnList stopJumbuneLogging() { LOGGER.debug("Removing jumbune from ThreadLocal"); InsnList il = new InsnList(); il.add(new LabelNode()); String methodDesc = null; if (isOldApiClazz()) { il.add(new VarInsnNode(Opcodes.ALOAD, 0)); il.add(new FieldInsnNode(Opcodes.GETFIELD, ConfigurationUtil .convertQualifiedClassNameToInternalName(getClassName()), InstrumentConstants.FIELD_UNLOADLOGGER, "Z")); methodDesc = Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE); } else { methodDesc = EMPTY_PARAMETER_VOID_RETURN; } il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, CLASSNAME_MAPREDUCEEXECUTIL, "stopJumbuneLogging", methodDesc)); return il; }
Example #10
Source File: Putstatic.java From nuls-v2 with MIT License | 6 votes |
public static void putstatic(Frame frame) { FieldInsnNode fieldInsnNode = frame.fieldInsnNode(); String className = fieldInsnNode.owner; String fieldName = fieldInsnNode.name; String fieldDesc = fieldInsnNode.desc; Object value; if (Descriptors.LONG_DESC.equals(fieldDesc)) { value = frame.operandStack.popLong(); } else if (Descriptors.DOUBLE_DESC.equals(fieldDesc)) { value = frame.operandStack.popDouble(); } else { value = frame.operandStack.pop(); } frame.heap.putStatic(className, fieldName, value); //Log.result(frame.getCurrentOpCode(), value, className, fieldName); }
Example #11
Source File: FeatureStructureClassGen.java From uima-uimaj with Apache License 2.0 | 6 votes |
private void addFeatureGetSet() { for (boolean isGet : GET_SET) { MethodNode mn = new MethodNode(ASM5, ACC_PUBLIC, // Get for non-array value fi.getGetterSetterName(isGet), isGet ? ("()" + rangeJavaDescriptor) : "(" + rangeJavaDescriptor + ")V", null, null); InsnList il = mn.instructions; il.add(new VarInsnNode(ALOAD, 0)); if (isGet) { il.add(new FieldInsnNode(GETFIELD, typeJavaClassName, featureFieldName, rangeJavaDescriptor)); il.add(new InsnNode(getReturnInst(fi))); } else { il.add(new VarInsnNode(getLoadInst(fi), 1)); // load ref, or primitive value il.add(new FieldInsnNode(PUTFIELD, typeJavaClassName, featureFieldName, rangeJavaDescriptor)); il.add(new InsnNode(RETURN)); } final boolean is2slotValue = ((TypeImpl) fi.getRange()).isLongOrDouble(); mn.maxStack = isGet ? 1 : is2slotValue ? 3 : 2; mn.maxLocals = isGet ? 1 : is2slotValue ? 3 : 2; cn.methods.add(mn); } }
Example #12
Source File: Putstatic.java From nuls with MIT License | 6 votes |
public static void putstatic(Frame frame) { FieldInsnNode fieldInsnNode = frame.fieldInsnNode(); String className = fieldInsnNode.owner; String fieldName = fieldInsnNode.name; String fieldDesc = fieldInsnNode.desc; Object value; if (Descriptors.LONG_DESC.equals(fieldDesc)) { value = frame.operandStack.popLong(); } else if (Descriptors.DOUBLE_DESC.equals(fieldDesc)) { value = frame.operandStack.popDouble(); } else { value = frame.operandStack.pop(); } frame.heap.putStatic(className, fieldName, value); //Log.result(frame.getCurrentOpCode(), value, className, fieldName); }
Example #13
Source File: Getstatic.java From nuls-v2 with MIT License | 6 votes |
public static void getstatic(Frame frame) { FieldInsnNode fieldInsnNode = frame.fieldInsnNode(); String className = fieldInsnNode.owner; String fieldName = fieldInsnNode.name; String fieldDesc = fieldInsnNode.desc; Object value = frame.heap.getStatic(className, fieldName); if (Descriptors.LONG_DESC.equals(fieldDesc)) { frame.operandStack.pushLong((long) value); } else if (Descriptors.DOUBLE_DESC.equals(fieldDesc)) { frame.operandStack.pushDouble((double) value); } else { frame.operandStack.push(value); } //Log.result(frame.getCurrentOpCode(), value, className, fieldName); }
Example #14
Source File: GroupClassGenerator.java From grappa with Apache License 2.0 | 6 votes |
protected static void convertXLoads(final InstructionGroup group) { final String owner = group.getGroupClassType().getInternalName(); InsnList insnList; for (final InstructionGraphNode node : group.getNodes()) { if (!node.isXLoad()) continue; final VarInsnNode insn = (VarInsnNode) node.getInstruction(); final FieldNode field = group.getFields().get(insn.var); final FieldInsnNode fieldNode = new FieldInsnNode(GETFIELD, owner, field.name, field.desc); insnList = group.getInstructions(); // insert the correct GETFIELD after the xLoad insnList.insert(insn, fieldNode); // change the load to ALOAD 0 insnList.set(insn, new VarInsnNode(ALOAD, 0)); } }
Example #15
Source File: StringEncryptionTransformer.java From deobfuscator with Apache License 2.0 | 6 votes |
private boolean isSmokeMethod(MethodNode method) { boolean containsArray = false; int putstatic = 0; int getstatic = 0; for(AbstractInsnNode ain : method.instructions.toArray()) if(ain.getOpcode() == Opcodes.ANEWARRAY) containsArray = true; else if(ain.getOpcode() == Opcodes.PUTSTATIC || ain.getOpcode() == Opcodes.GETSTATIC) if(((FieldInsnNode)ain).desc.equals("[Ljava/lang/String;")) { if(ain.getOpcode() == Opcodes.PUTSTATIC) putstatic++; else getstatic++; } return containsArray && putstatic == 2 && getstatic == 2; }
Example #16
Source File: BeforeFieldAccess.java From Mixin with MIT License | 6 votes |
@Override protected boolean matchesInsn(AbstractInsnNode insn) { if (insn instanceof FieldInsnNode && (((FieldInsnNode) insn).getOpcode() == this.opcode || this.opcode == -1)) { if (this.arrOpcode == 0) { return true; } if (insn.getOpcode() != Opcodes.GETSTATIC && insn.getOpcode() != Opcodes.GETFIELD) { return false; } return Type.getType(((FieldInsnNode)insn).desc).getSort() == Type.ARRAY; } return false; }
Example #17
Source File: ASMClassNodeAdapter.java From pinpoint with Apache License 2.0 | 6 votes |
public void addGetterMethod(final String methodName, final ASMFieldNodeAdapter fieldNode) { Assert.requireNonNull(methodName, "methodName"); Assert.requireNonNull(fieldNode, "fieldNode"); // no argument is (). final String desc = "()" + fieldNode.getDesc(); final MethodNode methodNode = new MethodNode(Opcodes.ACC_PUBLIC, methodName, desc, null, null); final InsnList instructions = getInsnList(methodNode); // load this. instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); // get fieldNode. instructions.add(new FieldInsnNode(Opcodes.GETFIELD, classNode.name, fieldNode.getName(), fieldNode.getDesc())); // return of type. final Type type = Type.getType(fieldNode.getDesc()); instructions.add(new InsnNode(type.getOpcode(Opcodes.IRETURN))); addMethodNode0(methodNode); }
Example #18
Source File: SourceInterpreter.java From JByteMod-Beta with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue unaryOperation(final AbstractInsnNode insn, final SourceValue value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: size = 2; break; case GETFIELD: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #19
Source File: ASMUtil_OLD.java From bytecode-viewer with GNU General Public License v3.0 | 6 votes |
public static void renameFieldNode(String originalParentName, String originalFieldName, String originalFieldDesc, String newFieldParent, String newFieldName, String newFieldDesc) { for (ClassNode c : BytecodeViewer.getLoadedClasses()) { for (Object o : c.methods.toArray()) { MethodNode m = (MethodNode) o; for (AbstractInsnNode i : m.instructions.toArray()) { if (i instanceof FieldInsnNode) { FieldInsnNode field = (FieldInsnNode) i; if (field.owner.equals(originalParentName) && field.name.equals(originalFieldName) && field.desc.equals(originalFieldDesc)) { if (newFieldParent != null) field.owner = newFieldParent; if (newFieldName != null) field.name = newFieldName; if (newFieldDesc != null) field.desc = newFieldDesc; } } } } } }
Example #20
Source File: ASMClassNodeAdapter.java From pinpoint with Apache License 2.0 | 6 votes |
public void addSetterMethod(final String methodName, final ASMFieldNodeAdapter fieldNode) { Assert.requireNonNull(methodName, "methodName"); Assert.requireNonNull(fieldNode, "fieldNode"); // void is V. final String desc = "(" + fieldNode.getDesc() + ")V"; final MethodNode methodNode = new MethodNode(Opcodes.ACC_PUBLIC, methodName, desc, null, null); final InsnList instructions = getInsnList(methodNode); // load this. instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); final Type type = Type.getType(fieldNode.getDesc()); // put field. instructions.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), 1)); instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, classNode.name, fieldNode.getName(), fieldNode.getDesc())); // return. instructions.add(new InsnNode(Opcodes.RETURN)); addMethodNode0(methodNode); }
Example #21
Source File: ApiDetector.java From javaide with GNU General Public License v3.0 | 6 votes |
private static MethodNode findEnumSwitchUsage(ClassNode classNode, String owner) { String target = ENUM_SWITCH_PREFIX + owner.replace('/', '$'); @SuppressWarnings("rawtypes") // ASM API List methodList = classNode.methods; for (Object f : methodList) { MethodNode method = (MethodNode) f; InsnList nodes = method.instructions; for (int i = 0, n = nodes.size(); i < n; i++) { AbstractInsnNode instruction = nodes.get(i); if (instruction.getOpcode() == Opcodes.GETSTATIC) { FieldInsnNode field = (FieldInsnNode) instruction; if (field.name.equals(target)) { return method; } } } } return null; }
Example #22
Source File: Getstatic.java From nuls with MIT License | 6 votes |
public static void getstatic(Frame frame) { FieldInsnNode fieldInsnNode = frame.fieldInsnNode(); String className = fieldInsnNode.owner; String fieldName = fieldInsnNode.name; String fieldDesc = fieldInsnNode.desc; Object value = frame.heap.getStatic(className, fieldName); if (Descriptors.LONG_DESC.equals(fieldDesc)) { frame.operandStack.pushLong((long) value); } else if (Descriptors.DOUBLE_DESC.equals(fieldDesc)) { frame.operandStack.pushDouble((double) value); } else { frame.operandStack.push(value); } //Log.result(frame.getCurrentOpCode(), value, className, fieldName); }
Example #23
Source File: FieldHandler.java From native-obfuscator with GNU General Public License v3.0 | 5 votes |
@Override protected void process(MethodContext context, FieldInsnNode node) { boolean isStatic = node.getOpcode() == Opcodes.GETSTATIC || node.getOpcode() == Opcodes.PUTSTATIC; CachedFieldInfo info = new CachedFieldInfo(node.owner, node.name, node.desc, isStatic); instructionName += "_" + Type.getType(node.desc).getSort(); if (isStatic) { props.put("class_ptr", context.getCachedClasses().getPointer(node.owner)); } int classId = context.getCachedClasses().getId(node.owner); context.output.append(String.format("if (!cclasses[%d] || env->IsSameObject(cclasses[%d], NULL)) { cclasses_mtx[%d].lock(); if (!cclasses[%d] || env->IsSameObject(cclasses[%d], NULL)) { if (jclass clazz = %s) { cclasses[%d] = (jclass) env->NewWeakGlobalRef(clazz); env->DeleteLocalRef(clazz); } } cclasses_mtx[%d].unlock(); %s } ", classId, classId, classId, classId, classId, MethodProcessor.getClassGetter(context, node.owner), classId, classId, trimmedTryCatchBlock)); int fieldId = context.getCachedFields().getId(info); props.put("fieldid", context.getCachedFields().getPointer(info)); context.output.append(String.format("if (!cfields[%d]) { cfields[%d] = env->Get%sFieldID(%s, %s, %s); %s } ", fieldId, fieldId, isStatic ? "Static" : "", context.getCachedClasses().getPointer(node.owner), context.getStringPool().get(node.name), context.getStringPool().get(node.desc), trimmedTryCatchBlock)); }
Example #24
Source File: ApiDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
private static boolean isSdkVersionLookup(@NonNull AbstractInsnNode instruction) { if (instruction.getOpcode() == Opcodes.GETSTATIC) { FieldInsnNode fieldNode = (FieldInsnNode) instruction; return (SDK_INT.equals(fieldNode.name) && ANDROID_OS_BUILD_VERSION.equals(fieldNode.owner)); } return false; }
Example #25
Source File: DebugGenerators.java From coroutines with GNU Lesser General Public License v3.0 | 5 votes |
/** * Generates instructions for generating marker instructions. These marker instructions are meant to be is useful for debugging * instrumented code. For example, you can spot a specific portion of instrumented code by looking for specific markers in the assembly * output. * @param markerType marker type (determines what kind of instructions are generated) * @param text text to print out * @return instructions to call System.out.println with a string constant * @throws NullPointerException if any argument is {@code null} */ public static InsnList debugMarker(MarkerType markerType, String text) { Validate.notNull(markerType); Validate.notNull(text); InsnList ret = new InsnList(); switch (markerType) { case NONE: break; case CONSTANT: ret.add(new LdcInsnNode(text)); ret.add(new InsnNode(Opcodes.POP)); break; case STDOUT: ret.add(new FieldInsnNode(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;")); ret.add(new LdcInsnNode(text)); ret.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false)); break; default: throw new IllegalStateException(); } return ret; }
Example #26
Source File: CodeBlock.java From grappa with Apache License 2.0 | 5 votes |
public CodeBlock getstatic(final String className, final String fieldName, final String fieldDesc) { instructionList.add(new FieldInsnNode(GETSTATIC, className, fieldName, fieldDesc)); return this; }
Example #27
Source File: LintDriver.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns whether the given issue is suppressed in the given method. * * @param issue the issue to be checked, or null to just check for "all" * @param classNode the class containing the issue * @param method the method containing the issue * @param instruction the instruction within the method, if any * @return true if there is a suppress annotation covering the specific * issue on this method */ public boolean isSuppressed( @Nullable Issue issue, @NonNull ClassNode classNode, @NonNull MethodNode method, @Nullable AbstractInsnNode instruction) { if (method.invisibleAnnotations != null) { @SuppressWarnings("unchecked") List<AnnotationNode> annotations = method.invisibleAnnotations; return isSuppressed(issue, annotations); } // Initializations of fields end up placed in generated methods (<init> // for members and <clinit> for static fields). if (instruction != null && method.name.charAt(0) == '<') { AbstractInsnNode next = LintUtils.getNextInstruction(instruction); if (next != null && next.getType() == AbstractInsnNode.FIELD_INSN) { FieldInsnNode fieldRef = (FieldInsnNode) next; FieldNode field = findField(classNode, fieldRef.owner, fieldRef.name); if (field != null && isSuppressed(issue, field)) { return true; } } else if (classNode.outerClass != null && classNode.outerMethod == null && isAnonymousClass(classNode)) { if (isSuppressed(issue, classNode)) { return true; } } } return false; }
Example #28
Source File: MethodByteCodeUtil.java From jumbune with GNU Lesser General Public License v3.0 | 5 votes |
/** * API to fetch the start node * @param node * @param locaVariables * @return * @throws IllegalArgumentException */ public static AbstractInsnNode getParamStartNode(AbstractInsnNode node, List<LocalVariableNode> locaVariables) throws IllegalArgumentException { AbstractInsnNode paramStartNode = null; if (node instanceof MethodInsnNode) { MethodInsnNode min = (MethodInsnNode) node; if ("<init>".equals(min.name)) { paramStartNode = getInitializationInstructionsSet(node); } else { AbstractInsnNode traversalNode = node; while (!isMethodStartNode(traversalNode) && traversalNode != null) { traversalNode = traversalNode.getPrevious(); } // Since we could not fetch startNode of parameter, this means // there must be another class's method call if (paramStartNode == null) { traversalNode = getParamStartNodeOfUDClassMethodCall(min, locaVariables); } paramStartNode = traversalNode; } } else if (node instanceof VarInsnNode) { VarInsnNode varNode = (VarInsnNode) node; if (!(varNode.var == InstrumentConstants.THREE || varNode.var == 0)) { paramStartNode = node; } } else if (node instanceof FieldInsnNode) { paramStartNode = node; } else{isParameterSetToNull(node); // If parameter is set to null then don't do anything as an // exception will be thrown } return paramStartNode; }
Example #29
Source File: ConfigureMapReduceAdapter.java From jumbune with GNU Lesser General Public License v3.0 | 5 votes |
/** * Sets the logger number. * * @return the insn list */ private InsnList setLoggerNumber() { InsnList il = new InsnList(); il.add(new VarInsnNode(Opcodes.ALOAD, 0)); il.add(new FieldInsnNode(Opcodes.GETFIELD, ConfigurationUtil .convertQualifiedClassNameToInternalName(getClassName()), InstrumentConstants.FIELD_LOGGERNUMBER, "I")); il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Type .getInternalName(MapReduceExecutionUtil.class), SET_LOG_NUM_METHOD, "(I)V")); return il; }
Example #30
Source File: ObfMapping.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") public AbstractInsnNode toInsn(int opcode) { if (isClass()) { return new TypeInsnNode(opcode, s_owner); } else if (isMethod()) { return new MethodInsnNode(opcode, s_owner, s_name, s_desc); } else { return new FieldInsnNode(opcode, s_owner, s_name, s_desc); } }