Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8056129

AtomicInteger is treated as primitive number with optimistic compilation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u40, 9
    • core-libs
    • None
    • b30
    • generic
    • generic

        This bug report is derived from this email to nashorn-dev alias:

        http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-August/003345.html


        File: atomic.js

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

        Expected output:

        1

        1

        Output seen with jdk8u20:

        1

        1

        Output seen with jdk8u-dev and jdk9-dev:

        1

        atomic.js:10 TypeError: 0 has no such function "incrementAndGet"

        Output with --optimistic-types=false option:

        1

        1

              attila Attila Szegedi
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: