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

Tal Liron tal.liron at threecrickets.com
Tue Aug 26 18:06:37 UTC 2014


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