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

AtomicInteger is treated as primitive number with optimistic compilation

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u40, 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b30
    • CPU:
      generic
    • OS:
      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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: