Java Code Examples for org.springframework.asm.MethodVisitor#visitTypeInsn()
The following examples show how to use
org.springframework.asm.MethodVisitor#visitTypeInsn() .
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: CodeFlow.java From spring-analysis-note with MIT License | 6 votes |
/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, @Nullable String descriptor) { if (descriptor != null && descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
Example 2
Source File: CodeFlow.java From spring-analysis-note with MIT License | 6 votes |
/** * Produce the correct bytecode to build an array. The opcode to use and the * signature to pass along with the opcode can vary depending on the signature * of the array type. * @param mv the methodvisitor into which code should be inserted * @param size the size of the array * @param arraytype the type of the array */ public static void insertNewArrayCode(MethodVisitor mv, int size, String arraytype) { insertOptimalLoad(mv, size); if (arraytype.length() == 1) { mv.visitIntInsn(NEWARRAY, CodeFlow.arrayCodeFor(arraytype)); } else { if (arraytype.charAt(0) == '[') { // Handling the nested array case here. // If vararg is [[I then we want [I and not [I; if (CodeFlow.isReferenceTypeArray(arraytype)) { mv.visitTypeInsn(ANEWARRAY, arraytype + ";"); } else { mv.visitTypeInsn(ANEWARRAY, arraytype); } } else { mv.visitTypeInsn(ANEWARRAY, arraytype.substring(1)); } } }
Example 3
Source File: OperatorInstanceof.java From java-technology-stack with MIT License | 6 votes |
@Override public void generateCode(MethodVisitor mv, CodeFlow cf) { getLeftOperand().generateCode(mv, cf); CodeFlow.insertBoxIfNecessary(mv, cf.lastDescriptor()); Assert.state(this.type != null, "No type available"); if (this.type.isPrimitive()) { // always false - but left operand code always driven // in case it had side effects mv.visitInsn(POP); mv.visitInsn(ICONST_0); // value of false } else { mv.visitTypeInsn(INSTANCEOF, Type.getInternalName(this.type)); } cf.pushDescriptor(this.exitTypeDescriptor); }
Example 4
Source File: OpPlus.java From spring-analysis-note with MIT License | 6 votes |
/** * Walk through a possible tree of nodes that combine strings and append * them all to the same (on stack) StringBuilder. */ private void walk(MethodVisitor mv, CodeFlow cf, @Nullable SpelNodeImpl operand) { if (operand instanceof OpPlus) { OpPlus plus = (OpPlus)operand; walk(mv, cf, plus.getLeftOperand()); walk(mv, cf, plus.getRightOperand()); } else if (operand != null) { cf.enterCompilationScope(); operand.generateCode(mv,cf); if (!"Ljava/lang/String".equals(cf.lastDescriptor())) { mv.visitTypeInsn(CHECKCAST, "java/lang/String"); } cf.exitCompilationScope(); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false); } }
Example 5
Source File: CodeFlow.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, String descriptor) { if (descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
Example 6
Source File: OperatorInstanceof.java From spring-analysis-note with MIT License | 6 votes |
@Override public void generateCode(MethodVisitor mv, CodeFlow cf) { getLeftOperand().generateCode(mv, cf); CodeFlow.insertBoxIfNecessary(mv, cf.lastDescriptor()); Assert.state(this.type != null, "No type available"); if (this.type.isPrimitive()) { // always false - but left operand code always driven // in case it had side effects mv.visitInsn(POP); mv.visitInsn(ICONST_0); // value of false } else { mv.visitTypeInsn(INSTANCEOF, Type.getInternalName(this.type)); } cf.pushDescriptor(this.exitTypeDescriptor); }
Example 7
Source File: CodeFlow.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, String descriptor) { if (descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
Example 8
Source File: OpPlus.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Walk through a possible tree of nodes that combine strings and append * them all to the same (on stack) StringBuilder. */ private void walk(MethodVisitor mv, CodeFlow cf, SpelNodeImpl operand) { if (operand instanceof OpPlus) { OpPlus plus = (OpPlus)operand; walk(mv,cf,plus.getLeftOperand()); walk(mv,cf,plus.getRightOperand()); } else { cf.enterCompilationScope(); operand.generateCode(mv,cf); if (!"Ljava/lang/String".equals(cf.lastDescriptor())) { mv.visitTypeInsn(CHECKCAST, "java/lang/String"); } cf.exitCompilationScope(); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false); } }
Example 9
Source File: CodeFlow.java From java-technology-stack with MIT License | 6 votes |
/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, @Nullable String descriptor) { if (descriptor != null && descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
Example 10
Source File: CodeFlow.java From spring-analysis-note with MIT License | 5 votes |
/** * For numbers, use the appropriate method on the number to convert it to the primitive type requested. * @param mv the method visitor into which instructions should be inserted * @param targetDescriptor the primitive type desired as output * @param stackDescriptor the descriptor of the type on top of the stack */ public static void insertUnboxNumberInsns( MethodVisitor mv, char targetDescriptor, @Nullable String stackDescriptor) { if (stackDescriptor == null) { return; } switch (targetDescriptor) { case 'D': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "doubleValue", "()D", false); break; case 'F': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "floatValue", "()F", false); break; case 'J': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "longValue", "()J", false); break; case 'I': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "intValue", "()I", false); break; // does not handle Z, B, C, S default: throw new IllegalArgumentException("Unboxing should not be attempted for descriptor '" + targetDescriptor + "'"); } }
Example 11
Source File: InlineList.java From spring4-understanding with Apache License 2.0 | 5 votes |
void generateClinitCode(String clazzname, String constantFieldName, MethodVisitor mv, CodeFlow codeflow, boolean nested) { mv.visitTypeInsn(NEW, "java/util/ArrayList"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V", false); if (!nested) { mv.visitFieldInsn(PUTSTATIC, clazzname, constantFieldName, "Ljava/util/List;"); } int childcount = getChildCount(); for (int c=0; c < childcount; c++) { if (!nested) { mv.visitFieldInsn(GETSTATIC, clazzname, constantFieldName, "Ljava/util/List;"); } else { mv.visitInsn(DUP); } // The children might be further lists if they are not constants. In this // situation do not call back into generateCode() because it will register another clinit adder. // Instead, directly build the list here: if (children[c] instanceof InlineList) { ((InlineList)children[c]).generateClinitCode(clazzname, constantFieldName, mv, codeflow, true); } else { children[c].generateCode(mv, codeflow); if (CodeFlow.isPrimitive(codeflow.lastDescriptor())) { CodeFlow.insertBoxIfNecessary(mv, codeflow.lastDescriptor().charAt(0)); } } mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z", true); mv.visitInsn(POP); } }
Example 12
Source File: InlineList.java From java-technology-stack with MIT License | 5 votes |
void generateClinitCode(String clazzname, String constantFieldName, MethodVisitor mv, CodeFlow codeflow, boolean nested) { mv.visitTypeInsn(NEW, "java/util/ArrayList"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V", false); if (!nested) { mv.visitFieldInsn(PUTSTATIC, clazzname, constantFieldName, "Ljava/util/List;"); } int childCount = getChildCount(); for (int c = 0; c < childCount; c++) { if (!nested) { mv.visitFieldInsn(GETSTATIC, clazzname, constantFieldName, "Ljava/util/List;"); } else { mv.visitInsn(DUP); } // The children might be further lists if they are not constants. In this // situation do not call back into generateCode() because it will register another clinit adder. // Instead, directly build the list here: if (this.children[c] instanceof InlineList) { ((InlineList)this.children[c]).generateClinitCode(clazzname, constantFieldName, mv, codeflow, true); } else { this.children[c].generateCode(mv, codeflow); String lastDesc = codeflow.lastDescriptor(); if (CodeFlow.isPrimitive(lastDesc)) { CodeFlow.insertBoxIfNecessary(mv, lastDesc.charAt(0)); } } mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z", true); mv.visitInsn(POP); } }
Example 13
Source File: ConstructorReference.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void generateCode(MethodVisitor mv, CodeFlow cf) { ReflectiveConstructorExecutor executor = ((ReflectiveConstructorExecutor) this.cachedExecutor); Constructor<?> constructor = executor.getConstructor(); String classDesc = constructor.getDeclaringClass().getName().replace('.', '/'); mv.visitTypeInsn(NEW, classDesc); mv.visitInsn(DUP); // children[0] is the type of the constructor, don't want to include that in argument processing SpelNodeImpl[] arguments = new SpelNodeImpl[children.length - 1]; System.arraycopy(children, 1, arguments, 0, children.length - 1); generateCodeForArguments(mv, cf, constructor, arguments); mv.visitMethodInsn(INVOKESPECIAL, classDesc, "<init>", CodeFlow.createSignatureDescriptor(constructor), false); cf.pushDescriptor(this.exitTypeDescriptor); }
Example 14
Source File: ReflectivePropertyAccessor.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void generateCode(String propertyName, MethodVisitor mv, CodeFlow cf) { boolean isStatic = Modifier.isStatic(this.member.getModifiers()); String descriptor = cf.lastDescriptor(); String classDesc = this.member.getDeclaringClass().getName().replace('.', '/'); if (!isStatic) { if (descriptor == null) { cf.loadTarget(mv); } if (descriptor == null || !classDesc.equals(descriptor.substring(1))) { mv.visitTypeInsn(CHECKCAST, classDesc); } } else { if (descriptor != null) { // A static field/method call will not consume what is on the stack, // it needs to be popped off. mv.visitInsn(POP); } } if (this.member instanceof Method) { mv.visitMethodInsn((isStatic ? INVOKESTATIC : INVOKEVIRTUAL), classDesc, this.member.getName(), CodeFlow.createSignatureDescriptor((Method) this.member), false); } else { mv.visitFieldInsn((isStatic ? GETSTATIC : GETFIELD), classDesc, this.member.getName(), CodeFlow.toJvmDescriptor(((Field) this.member).getType())); } }
Example 15
Source File: InlineList.java From spring-analysis-note with MIT License | 5 votes |
void generateClinitCode(String clazzname, String constantFieldName, MethodVisitor mv, CodeFlow codeflow, boolean nested) { mv.visitTypeInsn(NEW, "java/util/ArrayList"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V", false); if (!nested) { mv.visitFieldInsn(PUTSTATIC, clazzname, constantFieldName, "Ljava/util/List;"); } int childCount = getChildCount(); for (int c = 0; c < childCount; c++) { if (!nested) { mv.visitFieldInsn(GETSTATIC, clazzname, constantFieldName, "Ljava/util/List;"); } else { mv.visitInsn(DUP); } // The children might be further lists if they are not constants. In this // situation do not call back into generateCode() because it will register another clinit adder. // Instead, directly build the list here: if (this.children[c] instanceof InlineList) { ((InlineList)this.children[c]).generateClinitCode(clazzname, constantFieldName, mv, codeflow, true); } else { this.children[c].generateCode(mv, codeflow); String lastDesc = codeflow.lastDescriptor(); if (CodeFlow.isPrimitive(lastDesc)) { CodeFlow.insertBoxIfNecessary(mv, lastDesc.charAt(0)); } } mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z", true); mv.visitInsn(POP); } }
Example 16
Source File: CodeFlow.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * For numbers, use the appropriate method on the number to convert it to the primitive type requested. * @param mv the method visitor into which instructions should be inserted * @param targetDescriptor the primitive type desired as output * @param stackDescriptor the descriptor of the type on top of the stack */ public static void insertUnboxNumberInsns(MethodVisitor mv, char targetDescriptor, String stackDescriptor) { switch (targetDescriptor) { case 'D': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "doubleValue", "()D", false); break; case 'F': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "floatValue", "()F", false); break; case 'J': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "longValue", "()J", false); break; case 'I': if (stackDescriptor.equals("Ljava/lang/Object")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Number"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "intValue", "()I", false); break; // does not handle Z, B, C, S default: throw new IllegalArgumentException("Unboxing should not be attempted for descriptor '" + targetDescriptor + "'"); } }
Example 17
Source File: CodeFlow.java From java-technology-stack with MIT License | 4 votes |
/** * Insert any necessary cast and value call to convert from a boxed type to a * primitive value. * @param mv the method visitor into which instructions should be inserted * @param ch the primitive type desired as output * @param stackDescriptor the descriptor of the type on top of the stack */ public static void insertUnboxInsns(MethodVisitor mv, char ch, @Nullable String stackDescriptor) { if (stackDescriptor == null) { return; } switch (ch) { case 'Z': if (!stackDescriptor.equals("Ljava/lang/Boolean")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false); break; case 'B': if (!stackDescriptor.equals("Ljava/lang/Byte")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Byte"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false); break; case 'C': if (!stackDescriptor.equals("Ljava/lang/Character")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Character"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false); break; case 'D': if (!stackDescriptor.equals("Ljava/lang/Double")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Double"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false); break; case 'F': if (!stackDescriptor.equals("Ljava/lang/Float")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Float"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false); break; case 'I': if (!stackDescriptor.equals("Ljava/lang/Integer")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Integer"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false); break; case 'J': if (!stackDescriptor.equals("Ljava/lang/Long")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Long"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false); break; case 'S': if (!stackDescriptor.equals("Ljava/lang/Short")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Short"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false); break; default: throw new IllegalArgumentException("Unboxing should not be attempted for descriptor '" + ch + "'"); } }
Example 18
Source File: CodeFlow.java From spring4-understanding with Apache License 2.0 | 4 votes |
/** * Insert any necessary cast and value call to convert from a boxed type to a * primitive value * @param mv the method visitor into which instructions should be inserted * @param ch the primitive type desired as output * @param stackDescriptor the descriptor of the type on top of the stack */ public static void insertUnboxInsns(MethodVisitor mv, char ch, String stackDescriptor) { switch (ch) { case 'Z': if (!stackDescriptor.equals("Ljava/lang/Boolean")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false); break; case 'B': if (!stackDescriptor.equals("Ljava/lang/Byte")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Byte"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false); break; case 'C': if (!stackDescriptor.equals("Ljava/lang/Character")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Character"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false); break; case 'D': if (!stackDescriptor.equals("Ljava/lang/Double")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Double"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false); break; case 'F': if (!stackDescriptor.equals("Ljava/lang/Float")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Float"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false); break; case 'I': if (!stackDescriptor.equals("Ljava/lang/Integer")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Integer"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false); break; case 'J': if (!stackDescriptor.equals("Ljava/lang/Long")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Long"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false); break; case 'S': if (!stackDescriptor.equals("Ljava/lang/Short")) { mv.visitTypeInsn(CHECKCAST, "java/lang/Short"); } mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false); break; default: throw new IllegalArgumentException("Unboxing should not be attempted for descriptor '" + ch + "'"); } }
Example 19
Source File: OpPlus.java From java-technology-stack with MIT License | 4 votes |
@Override public void generateCode(MethodVisitor mv, CodeFlow cf) { if ("Ljava/lang/String".equals(this.exitTypeDescriptor)) { mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "()V", false); walk(mv, cf, getLeftOperand()); walk(mv, cf, getRightOperand()); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false); } else { this.children[0].generateCode(mv, cf); String leftDesc = this.children[0].exitTypeDescriptor; String exitDesc = this.exitTypeDescriptor; Assert.state(exitDesc != null, "No exit type descriptor"); char targetDesc = exitDesc.charAt(0); CodeFlow.insertNumericUnboxOrPrimitiveTypeCoercion(mv, leftDesc, targetDesc); if (this.children.length > 1) { cf.enterCompilationScope(); this.children[1].generateCode(mv, cf); String rightDesc = this.children[1].exitTypeDescriptor; cf.exitCompilationScope(); CodeFlow.insertNumericUnboxOrPrimitiveTypeCoercion(mv, rightDesc, targetDesc); switch (targetDesc) { case 'I': mv.visitInsn(IADD); break; case 'J': mv.visitInsn(LADD); break; case 'F': mv.visitInsn(FADD); break; case 'D': mv.visitInsn(DADD); break; default: throw new IllegalStateException( "Unrecognized exit type descriptor: '" + this.exitTypeDescriptor + "'"); } } } cf.pushDescriptor(this.exitTypeDescriptor); }
Example 20
Source File: OperatorInstanceof.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void generateCode(MethodVisitor mv, CodeFlow cf) { getLeftOperand().generateCode(mv, cf); mv.visitTypeInsn(INSTANCEOF,Type.getInternalName(this.type)); cf.pushDescriptor(this.exitTypeDescriptor); }