Ensure cast correctly included for OpPlus compilation
When the plus operator is used between strings in a SpEL expression and that expression is compiled, it is important to include a cast if computation of any of the operands isn't obviously leaving strings on the stack. Likewise if the stack contents are known to be strings, a cast should not be included. Issue: SPR-12426
This commit is contained in:
@@ -198,7 +198,7 @@ public class OpPlus extends Operator {
|
||||
else {
|
||||
cf.enterCompilationScope();
|
||||
operand.generateCode(mv,cf);
|
||||
if (cf.lastDescriptor() != "Ljava/lang/String") {
|
||||
if (!"Ljava/lang/String".equals(cf.lastDescriptor())) {
|
||||
mv.visitTypeInsn(CHECKCAST, "java/lang/String");
|
||||
}
|
||||
cf.exitCompilationScope();
|
||||
|
||||
Reference in New Issue
Block a user