Bug report: AtomicInteger is converted to a Number when returned from function

A. Sundararajan sundararajan.athijegannathan at oracle.com
Wed Aug 27 03:53:55 UTC 2014


Yes, this is a bug with 8u-dev and 9-dev - but not reproduced with 8u20 
binary. With 8u-dev and 9-dev, the scripts runs fine with 
--optimistic-types set to false. I've filed a bug:

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

Thanks for reporting this issue.

Thanks
-Sundar

On Tuesday 26 August 2014 11:36 PM, Tal Liron wrote:
> The bug is on trunk in 
> http://hg.openjdk.java.net/jdk8u/jdk8u-dev/nashorn.
>
> In the following program, the first part works as expected. However, 
> in the second part, it will fail at "x.incrementAndGet()" because "x" 
> is not an AtomicInteger instance.
>
> My guess is that the same bug may affect other Atomic* classes.
>
>
>
> x = new java.util.concurrent.atomic.AtomicInteger()
> x.incrementAndGet()
> print(x + '\n')
>
> function getAtomic() {
>   return new java.util.concurrent.atomic.AtomicInteger()
> }
>
> x = getAtomic()
> x.incrementAndGet()
> print(x + '\n')
>



More information about the nashorn-dev mailing list