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

Anonymous functions escape to surrounding scope when defined under "with" statement

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b72
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Test:

        with({}){ /*force vars into scope*/
           function () { /*line 2*/
             print("hello from nashorn");
           }
         }

        print(this["L:2"])

        Expected: undefined
        Observed:
        function () { /*line 2*/
             print("hello from nashorn");
           }


        This bug was reported via nashorn-dev alias ( http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-June/004776.html ) by Andreas Woess

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: