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')