JDK-8071927 : Coercion of Enums in Nashorn yields different result in Nashorn than in Rhino
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.script
  • Affected Version: 8u31
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2015-01-26
  • Updated: 2015-05-28
  • Resolved: 2015-05-28
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux krausem 3.13.0-44-generic #73~precise1-Ubuntu SMP Wed Dec 17 00:39:15 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
It seems that Java enums are no longer coerced into their string value:

java.math.RoundingMode.UP == "UP"

evaluates to true in Java 7 but to false in Java 8.

ADDITIONAL REGRESSION INFORMATION: 
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
krausem-> /opt/jdk1.7.0_65/bin/jrunscript -e 'print(java.math.RoundingMode.UP == "UP")'
true
[~]  
krausem-> /big/jdk1.8.0_40/bin/jrunscript -e 'print(java.math.RoundingMode.UP == "UP")'
false


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true in both cases
ACTUAL -
false in JDK 1.8

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
krausem-> /opt/jdk1.7.0_65/bin/jrunscript -e 'print(java.math.RoundingMode.UP == "UP")'
true
[~]  
krausem-> /big/jdk1.8.0_40/bin/jrunscript -e 'print(java.math.RoundingMode.UP == "UP")'
false
---------- END SOURCE ----------


Comments
Duplicate of JDK-8072426
28-05-2015