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

GlobalConstants produces wrong result with Object.defineProperty

XMLWordPrintable

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

        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

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

                Created:
                Updated:
                Resolved: