/** * Ask an argument to generate its bytecode and then follow it up * with any boxing/unboxing/checkcasting to ensure it matches the expected parameter descriptor. */ protected static void generateCodeForArgument(MethodVisitor mv, CodeFlow cf, SpelNodeImpl argument, String paramDesc) { cf.enterCompilationScope(); argument.generateCode(mv, cf); String lastDesc = cf.lastDescriptor(); Assert.state(lastDesc != null, "No last descriptor"); boolean primitiveOnStack = CodeFlow.isPrimitive(lastDesc); // Check if need to box it for the method reference? if (primitiveOnStack && paramDesc.charAt(0) == 'L') { CodeFlow.insertBoxIfNecessary(mv, lastDesc.charAt(0)); } else if (paramDesc.length() == 1 && !primitiveOnStack) { CodeFlow.insertUnboxInsns(mv, paramDesc.charAt(0), lastDesc); } else if (!paramDesc.equals(lastDesc)) { // This would be unnecessary in the case of subtyping (e.g. method takes Number but Integer passed in) CodeFlow.insertCheckCast(mv, paramDesc); } cf.exitCompilationScope(); }
/** * Ask an argument to generate its bytecode and then follow it up * with any boxing/unboxing/checkcasting to ensure it matches the expected parameter descriptor. */ protected static void generateCodeForArgument(MethodVisitor mv, CodeFlow cf, SpelNodeImpl argument, String paramDesc) { cf.enterCompilationScope(); argument.generateCode(mv, cf); String lastDesc = cf.lastDescriptor(); Assert.state(lastDesc != null, "No last descriptor"); boolean primitiveOnStack = CodeFlow.isPrimitive(lastDesc); // Check if need to box it for the method reference? if (primitiveOnStack && paramDesc.charAt(0) == 'L') { CodeFlow.insertBoxIfNecessary(mv, lastDesc.charAt(0)); } else if (paramDesc.length() == 1 && !primitiveOnStack) { CodeFlow.insertUnboxInsns(mv, paramDesc.charAt(0), lastDesc); } else if (!paramDesc.equals(lastDesc)) { // This would be unnecessary in the case of subtyping (e.g. method takes Number but Integer passed in) CodeFlow.insertCheckCast(mv, paramDesc); } cf.exitCompilationScope(); }
Assert.state(lastDesc != null, "No last descriptor"); if (!CodeFlow.isPrimitive(lastDesc)) { CodeFlow.insertUnboxInsns(mv, 'Z', lastDesc);
cf.exitCompilationScope(); if (unboxLeft) { CodeFlow.insertUnboxInsns(mv, targetType, leftDesc); cf.exitCompilationScope(); if (unboxRight) { CodeFlow.insertUnboxInsns(mv, targetType, rightDesc);
Assert.state(lastDesc != null, "No last descriptor"); if (!CodeFlow.isPrimitive(lastDesc)) { CodeFlow.insertUnboxInsns(mv, 'Z', lastDesc);
cf.exitCompilationScope(); if (unboxLeft) { CodeFlow.insertUnboxInsns(mv, targetType, leftDesc); cf.exitCompilationScope(); if (unboxRight) { CodeFlow.insertUnboxInsns(mv, targetType, rightDesc);
/** * Ask an argument to generate its bytecode and then follow it up * with any boxing/unboxing/checkcasting to ensure it matches the expected parameter descriptor. */ protected static void generateCodeForArgument(MethodVisitor mv, CodeFlow cf, SpelNodeImpl argument, String paramDesc) { cf.enterCompilationScope(); argument.generateCode(mv, cf); String lastDesc = cf.lastDescriptor(); Assert.state(lastDesc != null, "No last descriptor"); boolean primitiveOnStack = CodeFlow.isPrimitive(lastDesc); // Check if need to box it for the method reference? if (primitiveOnStack && paramDesc.charAt(0) == 'L') { CodeFlow.insertBoxIfNecessary(mv, lastDesc.charAt(0)); } else if (paramDesc.length() == 1 && !primitiveOnStack) { CodeFlow.insertUnboxInsns(mv, paramDesc.charAt(0), lastDesc); } else if (!paramDesc.equals(lastDesc)) { // This would be unnecessary in the case of subtyping (e.g. method takes Number but Integer passed in) CodeFlow.insertCheckCast(mv, paramDesc); } cf.exitCompilationScope(); }
Assert.state(lastDesc != null, "No last descriptor"); if (!CodeFlow.isPrimitive(lastDesc)) { CodeFlow.insertUnboxInsns(mv, 'Z', lastDesc);
cf.exitCompilationScope(); if (unboxLeft) { CodeFlow.insertUnboxInsns(mv, targetType, leftDesc); cf.exitCompilationScope(); if (unboxRight) { CodeFlow.insertUnboxInsns(mv, targetType, rightDesc);