Fix String equality

Issue: SPR-12105
This commit is contained in:
Stephane Nicoll 2014-08-20 17:40:36 +02:00
parent b5763fe326
commit 5b1341f4b5
1 changed files with 8 additions and 7 deletions

View File

@ -44,6 +44,7 @@ import org.springframework.expression.spel.support.ReflectivePropertyAccessor;
* *
* @author Andy Clement * @author Andy Clement
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll
* @since 3.0 * @since 3.0
*/ */
// TODO support multidimensional arrays // TODO support multidimensional arrays
@ -213,7 +214,7 @@ public class Indexer extends SpelNodeImpl {
} }
if (this.indexedType == IndexedType.array) { if (this.indexedType == IndexedType.array) {
if (exitTypeDescriptor == "I") { if ("I".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[I"); mv.visitTypeInsn(CHECKCAST,"[I");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();
@ -221,14 +222,14 @@ public class Indexer extends SpelNodeImpl {
codeflow.exitCompilationScope(); codeflow.exitCompilationScope();
mv.visitInsn(IALOAD); mv.visitInsn(IALOAD);
} }
else if (exitTypeDescriptor == "D") { else if ("D".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[D"); mv.visitTypeInsn(CHECKCAST,"[D");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();
index.generateCode(mv, codeflow); index.generateCode(mv, codeflow);
mv.visitInsn(DALOAD); mv.visitInsn(DALOAD);
} }
else if (exitTypeDescriptor == "J") { else if ("J".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[J"); mv.visitTypeInsn(CHECKCAST,"[J");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();
@ -236,7 +237,7 @@ public class Indexer extends SpelNodeImpl {
codeflow.exitCompilationScope(); codeflow.exitCompilationScope();
mv.visitInsn(LALOAD); mv.visitInsn(LALOAD);
} }
else if (exitTypeDescriptor == "F") { else if ("F".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[F"); mv.visitTypeInsn(CHECKCAST,"[F");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();
@ -244,7 +245,7 @@ public class Indexer extends SpelNodeImpl {
codeflow.exitCompilationScope(); codeflow.exitCompilationScope();
mv.visitInsn(FALOAD); mv.visitInsn(FALOAD);
} }
else if (exitTypeDescriptor == "S") { else if ("S".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[S"); mv.visitTypeInsn(CHECKCAST,"[S");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();
@ -252,7 +253,7 @@ public class Indexer extends SpelNodeImpl {
codeflow.exitCompilationScope(); codeflow.exitCompilationScope();
mv.visitInsn(SALOAD); mv.visitInsn(SALOAD);
} }
else if (exitTypeDescriptor == "B") { else if ("B".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[B"); mv.visitTypeInsn(CHECKCAST,"[B");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();
@ -260,7 +261,7 @@ public class Indexer extends SpelNodeImpl {
codeflow.exitCompilationScope(); codeflow.exitCompilationScope();
mv.visitInsn(BALOAD); mv.visitInsn(BALOAD);
} }
else if (exitTypeDescriptor == "C") { else if ("C".equals(exitTypeDescriptor)) {
mv.visitTypeInsn(CHECKCAST,"[C"); mv.visitTypeInsn(CHECKCAST,"[C");
SpelNodeImpl index = this.children[0]; SpelNodeImpl index = this.children[0];
codeflow.enterCompilationScope(); codeflow.enterCompilationScope();