Closed
Description
Denis Zhdanov opened SPR-14863 and commented
There is a problem with != SpEL in compiled form. It compares strings using reference identity instead of equals().
I.e. the following byte code is generated from the following expression data['my-key'] != 'my-value' (note if_acmpeq instruction usage)
invokevirtual org/denis/spring/spel/Test$MyContext/getData()Ljava/util/Map;
checkcast java/util/Map
ldc "my-key"
invokeinterface java/util/Map/get(Ljava/lang/Object;)Ljava/lang/Object; 2
ldc "my-value"
if_acmpeq 11
iconst_1
goto 12
iconst_0
invokestatic java/lang/Boolean/valueOf(Z)Ljava/lang/Boolean;
areturn
A complete standalone project which illustrates the problem can be found here
I checked spring source code and the problem is in the OpNE class.
There was a similar report for the OpEQ class (#13832) and it was fixed - OpEQ
Affects: 4.3.3
Issue Links:
- SpEL: OpEQ should use equals() [SPR-9194] #13832 SpEL: OpEQ should use equals()