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

GlobalConstants produces wrong result with Object.defineProperty

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b40
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        var x = 1;
        for(var i = 2; i < 5; ++i) {
            print(x);
            Object.defineProperty(this, "x", {value: i });
        }
        print(x);

        Expected result:
        1
        2
        3
        4

        Observed result:
        1
        1
        1
        4

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                lagergren Marcus Lagergren
                Reporter:
                attila Attila Szegedi
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: