Fix bytecode generation for SpEL OpPlus
Without this change the plus operator would fail to include a CHECKCAST in generated bytecode when it was compiled in cases where one of the operands has a runtime type of String but a statically declared type that was not String (i.e. Object). Issue: SPR-12426
This commit is contained in:
@@ -206,6 +206,9 @@ public class OpPlus extends Operator {
|
||||
else {
|
||||
cf.enterCompilationScope();
|
||||
operand.generateCode(mv,cf);
|
||||
if (cf.lastDescriptor() != "Ljava/lang/String") {
|
||||
mv.visitTypeInsn(CHECKCAST, "java/lang/String");
|
||||
}
|
||||
cf.exitCompilationScope();
|
||||
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user