Skip to content

Commit 5b1341f

Browse files
committed
Fix String equality
Issue: SPR-12105
1 parent b5763fe commit 5b1341f

File tree

1 file changed

+8
-7
lines changed
  • spring-expression/src/main/java/org/springframework/expression/spel/ast

1 file changed

+8
-7
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
*
4545
* @author Andy Clement
4646
* @author Phillip Webb
47+
* @author Stephane Nicoll
4748
* @since 3.0
4849
*/
4950
// TODO support multidimensional arrays
@@ -213,54 +214,54 @@ public void generateCode(MethodVisitor mv, CodeFlow codeflow) {
213214
}
214215

215216
if (this.indexedType == IndexedType.array) {
216-
if (exitTypeDescriptor == "I") {
217+
if ("I".equals(exitTypeDescriptor)) {
217218
mv.visitTypeInsn(CHECKCAST,"[I");
218219
SpelNodeImpl index = this.children[0];
219220
codeflow.enterCompilationScope();
220221
index.generateCode(mv, codeflow);
221222
codeflow.exitCompilationScope();
222223
mv.visitInsn(IALOAD);
223224
}
224-
else if (exitTypeDescriptor == "D") {
225+
else if ("D".equals(exitTypeDescriptor)) {
225226
mv.visitTypeInsn(CHECKCAST,"[D");
226227
SpelNodeImpl index = this.children[0];
227228
codeflow.enterCompilationScope();
228229
index.generateCode(mv, codeflow);
229230
mv.visitInsn(DALOAD);
230231
}
231-
else if (exitTypeDescriptor == "J") {
232+
else if ("J".equals(exitTypeDescriptor)) {
232233
mv.visitTypeInsn(CHECKCAST,"[J");
233234
SpelNodeImpl index = this.children[0];
234235
codeflow.enterCompilationScope();
235236
index.generateCode(mv, codeflow);
236237
codeflow.exitCompilationScope();
237238
mv.visitInsn(LALOAD);
238239
}
239-
else if (exitTypeDescriptor == "F") {
240+
else if ("F".equals(exitTypeDescriptor)) {
240241
mv.visitTypeInsn(CHECKCAST,"[F");
241242
SpelNodeImpl index = this.children[0];
242243
codeflow.enterCompilationScope();
243244
index.generateCode(mv, codeflow);
244245
codeflow.exitCompilationScope();
245246
mv.visitInsn(FALOAD);
246247
}
247-
else if (exitTypeDescriptor == "S") {
248+
else if ("S".equals(exitTypeDescriptor)) {
248249
mv.visitTypeInsn(CHECKCAST,"[S");
249250
SpelNodeImpl index = this.children[0];
250251
codeflow.enterCompilationScope();
251252
index.generateCode(mv, codeflow);
252253
codeflow.exitCompilationScope();
253254
mv.visitInsn(SALOAD);
254255
}
255-
else if (exitTypeDescriptor == "B") {
256+
else if ("B".equals(exitTypeDescriptor)) {
256257
mv.visitTypeInsn(CHECKCAST,"[B");
257258
SpelNodeImpl index = this.children[0];
258259
codeflow.enterCompilationScope();
259260
index.generateCode(mv, codeflow);
260261
codeflow.exitCompilationScope();
261262
mv.visitInsn(BALOAD);
262263
}
263-
else if (exitTypeDescriptor == "C") {
264+
else if ("C".equals(exitTypeDescriptor)) {
264265
mv.visitTypeInsn(CHECKCAST,"[C");
265266
SpelNodeImpl index = this.children[0];
266267
codeflow.enterCompilationScope();

0 commit comments

Comments
 (0)