Unexpected equality behavior (java.lang.Long)
João Paulo Varandas
joaovarandas at inpaas.com
Thu Aug 4 13:48:54 UTC 2016
Hi guys!
It seems that version 1.8.0_101 has a bug in equality for same java data
types (java.lang.Long).
Check that:
jjs> new java.lang.Long(10) == new java.lang.Long(10)
false
Oops!?
See the gist:
https://gist.github.com/joaovarandas/51567bd3b576d48a4c574d60d5a60ba3
The results for all types should be ...
== true
=== true
equals true
But for java.lang.Long and java.math.BigDecimal:
== false
=== false
equals true
Maybe we could expand the test to other classes too, but the issue ...
- It does happen in 1.8.0_101.
- It does not 1.8.0_91.
- It does happen with other classes (BigDecimal).
- It does not happen with String.
- It does not happen with Integer.
I understand this is not an expected behavior. For now I'm rolling back
to 1.8.0_91 in my environments.
Do you me to file a bug?
Thanks
J
--
"Esta mensagem, incluindo seus anexos, pode conter informacoes
confidenciais e privilegiadas.
Se voce a recebeu por engano, solicitamos que a apague e avise o remetente
imediatamente.
Opinioes ou informacoes aqui contidas nao refletem necessariamente a
posicao oficial da Plusoft."
"Antes de imprimir, pense em sua responsabilidade e compromisso com o MEIO
AMBIENTE"
More information about the nashorn-dev
mailing list