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
(cherry picked from commit 58756b0)
This commit is contained in:
committed by
Juergen Hoeller
parent
55494362ef
commit
e410129aaf
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -206,7 +206,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();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user