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

introducing local into a function inside with statement confuses its scope

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • None
    • core-libs
    • None
    • b82
    • generic
    • generic
    • Verified

    Description

      Andreas Rieber reported this:

      ------------------------
      var guiPkgs = { JFrame: function() { print("created"); } };

      with (guiPkgs) {
           function main() {
              var frame; // <---- this local variable causes scope to be not set properly

              function createFrame() {
                  frame = new JFrame();
              }

              createFrame();
          }
      }

      main();

      >>
      scriptpad.js:9 ReferenceError: "JFrame" is not defined

      See also JDK-8006755

      Attachments

        Activity

          People

            attila Attila Szegedi
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: