I definitely consider it to be a bug. Accepted behaviours would be to either return true (if ToPrimitive on a POJO is allowed) or throw a TypeError (if it isn't). Returning false is incorrect.
I filed https://bugs.openjdk.java.net/browse/JDK-8072426 Attila. On Feb 3, 2015, at 5:15 PM, Krause, Michael <[email protected]> wrote: > Hi, thank you for the concise explanation! > > [...] > if this qualifies as a bug, could you please create one? > Thank you! >> ________________________________________ >> Von: Attila Szegedi [[email protected]] >> Gesendet: Dienstag, 3. Februar 2015 15:15 >> An: Krause, Michael >> Cc: [email protected] >> Betreff: Re: Coercion of Java Enums works differently than in Rhino >> I'm throwing all this out here because we'd like to hear what the community >> thinks about which'd be the preferred way to go. >> >> Attila. >> >> On Feb 3, 2015, at 1:26 PM, Krause, Michael <[email protected]> wrote: >> >>> Hi, >>> >>> It seems that in Nashorn 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 when executed in the >>> respective JavaScript engine. >>> >>> >>> Does anybody know if this is actually a bug or just something in the >>> specification? >>> >>> Thanks! > >
