AbstractInsnNode previousOfLastInsnNode = lastInsnNode.getPrevious(); if (firstInsnNode.getOpcode() != Opcodes.ALOAD || !(firstInsnNode instanceof VarInsnNode) || ((VarInsnNode)firstInsnNode).var != 0) { throw new AssertionError("illegal bridge method"); if (previousOfLastInsnNode.getOpcode() != Opcodes.INVOKEVIRTUAL || !(previousOfLastInsnNode instanceof MethodInsnNode) || !((MethodInsnNode)previousOfLastInsnNode).owner.equals(classEntry.classNode.name)) { throw new AssertionError("illegal bridge method"); if (!isReturnCode(lastInsnNode.getOpcode()) || !(lastInsnNode instanceof InsnNode)) { throw new AssertionError("illegal bridge method"); for (AbstractInsnNode abstractInsnNode = firstInsnNode.getNext(); abstractInsnNode != previousOfLastInsnNode; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode instanceof VarInsnNode && isLoadCode(abstractInsnNode.getOpcode())) { continue; if (abstractInsnNode instanceof TypeInsnNode && abstractInsnNode.getOpcode() == Opcodes.CHECKCAST) { continue;
/** * Makes the given visitor visit all of the instructions in this list. * * @param mv * the method visitor that must visit the instructions. */ public void accept(final MethodVisitor mv) { AbstractInsnNode insn = first; while (insn != null) { insn.accept(mv); insn = insn.next; } }
if (node.getType() == AbstractInsnNode.JUMP_INSN && node.getOpcode() != JSR) { markSubroutineWalkDFS(sub, destidx, anyvisited); if (node.getType() == AbstractInsnNode.TABLESWITCH_INSN) { TableSwitchInsnNode tsnode = (TableSwitchInsnNode) node; int destidx = instructions.indexOf(tsnode.dflt); if (node.getType() == AbstractInsnNode.LOOKUPSWITCH_INSN) { LookupSwitchInsnNode lsnode = (LookupSwitchInsnNode) node; int destidx = instructions.indexOf(lsnode.dflt); switch (instructions.get(index).getOpcode()) { case GOTO: case RET:
@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; }
final BasicValue value1, final BasicValue value2) throws AnalyzerException { switch (insn.getOpcode()) { case IALOAD: case BALOAD:
for (AbstractInsnNode abstractInsnNode = instructions.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode.getOpcode() == Opcodes.INVOKESTATIC) { MethodInsnNode methodInsnNode = (MethodInsnNode)abstractInsnNode; if (methodInsnNode.name.equals("getEntityManagerFactoryBuilder") && } else if (methodInsnNode.name.equals("locatePersistenceUnits") && methodInsnNode.owner.equals(ASM.getInternalName(PersistenceXmlParser.class))) { AbstractInsnNode nextInsnNode = abstractInsnNode.getNext(); instructions.remove(methodInsnNode.getPrevious()); instructions.remove(methodInsnNode); methodInsnNode.owner = ASM.getInternalName(HibernatePersistenceProvider.class); } else if (abstractInsnNode.getOpcode() == Opcodes.CHECKCAST) { TypeInsnNode typeInsnNode = (TypeInsnNode)abstractInsnNode; if (typeInsnNode.desc.equals(ASM.getInternalName(ParsedPersistenceXmlDescriptor.class))) { typeInsnNode.desc = ASM.getInternalName(PersistenceUnitInfoDescriptor.class); } else if (abstractInsnNode.getOpcode() == Opcodes.INVOKEVIRTUAL) { MethodInsnNode methodInsnNode = (MethodInsnNode)abstractInsnNode; if (methodInsnNode.owner.equals(ASM.getInternalName(ParsedPersistenceXmlDescriptor.class))) {
for (AbstractInsnNode abstractInsnNode = instructions.getLast(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getPrevious()) { if (stackLength.equals(this.selfWillBeStackTopInsnMap.get(abstractInsnNode))) { FieldInsnNode objectModelFieldInsnNode =
AbstractInsnNode insn = instructions.get(i); if (insn.getType() == AbstractInsnNode.LABEL) { LabelNode ilbl = (LabelNode) insn;
@Override public SourceValue binaryOperation(final AbstractInsnNode insn, final SourceValue value1, final SourceValue value2) { int size; switch (insn.getOpcode()) { case LALOAD: case DALOAD: case LADD: case DADD: case LSUB: case DSUB: case LMUL: case DMUL: case LDIV: case DDIV: case LREM: case DREM: case LSHL: case LSHR: case LUSHR: case LAND: case LOR: case LXOR: size = 2; break; default: size = 1; } return new SourceValue(size, insn); }
protected static InsnList cloneInsnList(InsnList insnList) { InsnList newInsnList = new InsnList(); for (AbstractInsnNode abstractInsnNode = insnList.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { newInsnList.add(cloneInsnNode(abstractInsnNode)); } return newInsnList; }
for (AbstractInsnNode abstractInsnNode = instructions.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode.getOpcode() == Opcodes.NEW) { TypeInsnNode typeInsnNode = (TypeInsnNode)abstractInsnNode; if (typeInsnNode.desc.equals(ASM.getInternalName(EntityManagerFactoryImpl.class))) { typeInsnNode.desc = ASM.getInternalName(org.babyfish.hibernate.cfg.Configuration.class); } else if (abstractInsnNode.getOpcode() == Opcodes.INVOKESPECIAL) { MethodInsnNode methodInsnNode = (MethodInsnNode)abstractInsnNode; if (methodInsnNode.name.equals("<init>")) { } else if (abstractInsnNode.getOpcode() == Opcodes.INVOKEVIRTUAL) { MethodInsnNode methodInsnNode = (MethodInsnNode)abstractInsnNode; if (methodInsnNode.name.equals("withTccl") && AbstractInsnNode tmpInsnNode = initWorkInsnNode.getPrevious(); while (true) { if (tmpInsnNode.getOpcode() == Opcodes.NEW) { TypeInsnNode typeInsnNode = (TypeInsnNode)tmpInsnNode; if (typeInsnNode.desc.equals(oldOwnerName)) { tmpInsnNode = tmpInsnNode.getPrevious();
@Override public SourceValue naryOperation(final AbstractInsnNode insn, final List<? extends SourceValue> values) { int size; int opcode = insn.getOpcode(); if (opcode == MULTIANEWARRAY) { size = 1; } else { String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc : ((MethodInsnNode) insn).desc; size = Type.getReturnType(desc).getSize(); } return new SourceValue(size, insn); }
for (AbstractInsnNode abstractInsnNode = instructions.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode instanceof MethodInsnNode) { MethodInsnNode methodInsnNode = (MethodInsnNode)abstractInsnNode;
for (AbstractInsnNode abstractInsnNode = instructions.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode instanceof FieldInsnNode) { FieldInsnNode fieldInsnNode = (FieldInsnNode)abstractInsnNode; if (invokedMethodEntry.isInit()) { boolean matched = false; for (AbstractInsnNode prev = abstractInsnNode.getPrevious(); prev != null; prev = prev.getPrevious()) { if (prev.getOpcode() == Opcodes.NEW && ASM.getInternalName(((TypeInsnNode)prev).desc).equals(methodInsnNode.owner)) { if (prev.getNext().getOpcode() != Opcodes.DUP) { throw new IllegalProgramException( nextOpCodeOfNewMustBeDup( instructions.remove(prev.getNext()); instructions.remove(prev); matched = true;
@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); }
for (AbstractInsnNode abstractInsnNode = instructions.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode.getOpcode() == Opcodes.ARETURN) { InsnList tmpInstructions = new InsnList(); tmpInstructions.add(new InsnNode(Opcodes.DUP)); for (AbstractInsnNode abstractInsnNode = instructions.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode.getOpcode() == Opcodes.PUTFIELD) { FieldInsnNode fieldInsnNode = (FieldInsnNode)abstractInsnNode; if (fieldInsnNode.name.equals("queryLoader") && } else if (abstractInsnNode.getOpcode() == Opcodes.ASTORE && abstractInsnNode.getPrevious() instanceof MethodInsnNode) { MethodInsnNode prevMethodInsnNode = (MethodInsnNode)abstractInsnNode.getPrevious(); if (prevMethodInsnNode.name.equals("analyze") && prevMethodInsnNode.owner.equals(ASM.getInternalName(QueryTranslatorImpl.class))) {