AtomicInteger is treated as primitive number with optimistic compilation

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 8u40, 9
    • Component/s: 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

              Assignee:
              Attila Szegedi
              Reporter:
              Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: