Objects with more than 256 keys cause all associated values to become undefined

Hannes Wallnoefer hannes.wallnoefer at oracle.com
Mon May 4 13:20:08 UTC 2015


Hi Mark,

Thanks for the report. That bug was fixed recently, the fix is in 8u60.

https://bugs.openjdk.java.net/browse/JDK-8074545

Note that the bug is marked confidential because its parent bug contains 
third-party sources, I'll try to make it publicly accessible.

Hannes

Am 2015-05-04 um 05:47 schrieb Mark Elliot:
> I ran across this while trying to get the TypeScript compiler to run
> natively on Nashorn. The compiler includes a large mapping of keys to
> diagnostic descriptions in ts.Diagnostics.
>
> After bumping from 1.8.0_05 to 1.8.0_45, the values in the ts.Diagnostics
> map became undefied. I've boiled the issue down to a simple repro, and it
> appears that objects of the form:
>
> var foo = {
>      field_1: { code: 1 },
>      field_2: { code: 2 },
>      ...
>      field_256: { code: 256 },
>      field_257: { code: 257 }
> }
>
> Cause all values associated with keys to become undefined, even though the
> keys themselves exist. That is, attempting to access any value, e.g.
> foo.field_1, will return undefined, instead of the expected object.
>
> The problem appears to occur when more than 256 keys are specified, as
> running these two gists through jjs would easily show:
> 256 keys: https://gist.github.com/markelliot/359810cdd27c90f0e13d
> 257 keys: https://gist.github.com/markelliot/cf6268b0627b54921583
>
> Notably, I don't observe the issue when the values are not objects, so this
> object would behave as one would expect:
>
> var bar = {
>      field_1: 1,
>      field_2: 2,
>      ...
>      field_256: 256,
>      field_257: 257
> }



More information about the nashorn-dev mailing list