@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { return mv.visitAnnotation(desc, visible); }
@Override public AnnotationVisitor visitAnnotationDefault() { return mv.visitAnnotationDefault(); }
/** * Visits a non standard attribute of this method. * * @param attr * an attribute. */ public void visitAttribute(Attribute attr) { if (mv != null) { mv.visitAttribute(attr); } }
Label handler = readLabel(readUnsignedShort(u + 6), labels); String type = readUTF8(items[readUnsignedShort(u + 8)], c); mv.visitTryCatchBlock(start, end, handler, type); u += 8; mv.visitLabel(l); if ((context.flags & SKIP_DEBUG) == 0 && l.line > 0) { mv.visitLineNumber(l.line, l); mv.visitFrame(Opcodes.F_NEW, frame.localCount, frame.local, frame.stackCount, frame.stack); } else { mv.visitFrame(frame.mode, frame.localDiff, frame.local, frame.stackCount, frame.stack); switch (ClassWriter.TYPE[opcode]) { case ClassWriter.NOARG_INSN: mv.visitInsn(opcode); u += 1; break; if (opcode > Opcodes.ISTORE) { opcode -= 59; // ISTORE_0 mv.visitVarInsn(Opcodes.ISTORE + (opcode >> 2), opcode & 0x3); } else { opcode -= 26; // ILOAD_0 mv.visitVarInsn(Opcodes.ILOAD + (opcode >> 2), opcode & 0x3);
mv.visitParameter(readUTF8(v, c), readUnsignedShort(v + 2)); AnnotationVisitor dv = mv.visitAnnotationDefault(); readAnnotationValue(dann, c, null, dv); if (dv != null) { for (int i = readUnsignedShort(anns), v = anns + 2; i > 0; --i) { v = readAnnotationValues(v + 2, c, true, mv.visitAnnotation(readUTF8(v, c), true)); for (int i = readUnsignedShort(ianns), v = ianns + 2; i > 0; --i) { v = readAnnotationValues(v + 2, c, true, mv.visitAnnotation(readUTF8(v, c), false)); v = readAnnotationTarget(context, v); v = readAnnotationValues(v + 2, c, true, mv.visitTypeAnnotation(context.typeRef, context.typePath, readUTF8(v, c), true)); v = readAnnotationTarget(context, v); v = readAnnotationValues(v + 2, c, true, mv.visitTypeAnnotation(context.typeRef, context.typePath, readUTF8(v, c), false)); Attribute attr = attributes.next; attributes.next = null; mv.visitAttribute(attributes); attributes = attr;
protected void instructionGenerate(MethodExecuteContext context){ factorsToStack(context); negativeCmp(context, falseLbl); MethodVisitor mv = context.getInstructions().getMv(); //push true to stack mv.visitInsn(Opcodes.ICONST_0 + 1); mv.visitJumpInsn(Opcodes.GOTO, trueLbl); mv.visitLabel(falseLbl); //push false to stack mv.visitInsn(Opcodes.ICONST_0); mv.visitLabel(trueLbl); }
/** * Visits a zero operand instruction. * * @param opcode * the opcode of the instruction to be visited. This opcode is * either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, * ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, * FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, * LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, * IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, * SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, * DUP2_X2, SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, * IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, * FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, * IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D, * L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S, * LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN, * DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, * or MONITOREXIT. */ public void visitInsn(int opcode) { if (mv != null) { mv.visitInsn(opcode); } }
/** * Visits a field instruction. A field instruction is an instruction that * loads or stores the value of a field of an object. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD. * @param owner * the internal name of the field's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the field's name. * @param desc * the field's descriptor (see {@link Type Type}). */ public void visitFieldInsn(int opcode, String owner, String name, String desc) { if (mv != null) { mv.visitFieldInsn(opcode, owner, name, desc); } }
/** * Visits an instruction with a single int operand. * * @param opcode * the opcode of the instruction to be visited. This opcode is * either BIPUSH, SIPUSH or NEWARRAY. * @param operand * the operand of the instruction to be visited.<br> * When opcode is BIPUSH, operand value should be between * Byte.MIN_VALUE and Byte.MAX_VALUE.<br> * When opcode is SIPUSH, operand value should be between * Short.MIN_VALUE and Short.MAX_VALUE.<br> * When opcode is NEWARRAY, operand value should be one of * {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR}, * {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE}, * {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT}, * {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}. */ public void visitIntInsn(int opcode, int operand) { if (mv != null) { mv.visitIntInsn(opcode, operand); } }
/** * Visits an IINC instruction. * * @param var * index of the local variable to be incremented. * @param increment * amount to increment the local variable by. */ public void visitIincInsn(int var, int increment) { if (mv != null) { mv.visitIincInsn(var, increment); } }
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { mv.visitFrame(type, nLocal, local, nStack, stack); }
/** * Visits the end of the method. This method, which is the last one to be * called, is used to inform the visitor that all the annotations and * attributes of the method have been visited. */ public void visitEnd() { if (mv != null) { mv.visitEnd(); } } }
/** * Starts the visit of the method's code, if any (i.e. non abstract method). */ public void visitCode() { if (mv != null) { mv.visitCode(); } }
@Override protected void executing(MethodExecuteContext context) { MethodVisitor mv = context.getInstructions().getMv(); OperandStack stack = context.getInstructions().getOperandStack(); mv.visitJumpInsn(Opcodes.IFEQ, trueLbl); mv.visitInsn(Opcodes.ICONST_0); mv.visitJumpInsn(Opcodes.GOTO, falseLbl); mv.visitLabel(trueLbl); mv.visitInsn(Opcodes.ICONST_1); mv.visitLabel(falseLbl); stack.pop(); stack.push(Type.BOOLEAN_TYPE); stack.printState(); }
@Override public void visitInsn(int opcode) { if (invokedSuper) { super.visitInsn(opcode); }else{ addSuperConstructorMap(constructorDesc, new VisitInsnAdapter(opcode)); } }
@Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { if (invokedSuper){ super.visitFieldInsn(opcode, owner, name, desc); }else{ addSuperConstructorMap(constructorDesc, new VisitFieldInsnAdapter(opcode, owner, name, desc)); } }
@Override public void visitIntInsn(int opcode, int operand) { if (invokedSuper){ super.visitIntInsn(opcode, operand); }else{ addSuperConstructorMap(constructorDesc, new VisitIntInsnAdapter(operand, operand)); } }
@Override public void visitIincInsn(final int var, final int increment) { stackLocalOperator(IINC); mv.visitIincInsn(var, increment); }
Object[] stack) { if (mv != null) { mv.visitFrame(type, nLocal, local, nStack, stack);
@Override public void visitEnd() { mv.visitEnd(); }