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

Anonymous function statements leak internal function names into global scope

    Details

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

      Backports

        Description

        {code}
        function () { // line 1
          print("hello from nashorn");
        }

        print(this["L:1"]); // print function on line 1
        {code}

        expected:
        undefined

        actual:
        function () { // line 1
          print("hello from nashorn");
        }

        {code:title=--print-parse}
        [<unknown>] function :program() {
            [|1|];
            var L:1 = [<unknown>] function L:1() {
                [|2|];
                print("hello from nashorn");
            }
            [|5|];
            print(this["L:1"]);
        }
        {code}

        Note that this is a Nashorn syntax extension, and it does not happen if function is assigned to a variable.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  aw Andreas Woess
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: