Coercion of Java Enums works differently than in Rhino
Attila Szegedi
attila.szegedi at oracle.com
Tue Feb 3 18:24:09 UTC 2015
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 <michael.krause at grawe.at> wrote:
> Hi, thank you for the concise explanation!
>
> [...]
> if this qualifies as a bug, could you please create one?
> Thank you!
>> ________________________________________
>> Von: Attila Szegedi [attila.szegedi at oracle.com]
>> Gesendet: Dienstag, 3. Februar 2015 15:15
>> An: Krause, Michael
>> Cc: nashorn-dev at openjdk.java.net
>> 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 <michael.krause at grawe.at> 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!
>
>
More information about the nashorn-dev
mailing list