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

AtomicInteger is treated as primitive number with optimistic compilation

    XMLWordPrintable

Details

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

    Backports

      Description

        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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: