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

Functions inside with statements dont get correct scope

    XMLWordPrintable

Details

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

    Description

      from Andreas Rieber <rieberandreas@gmail.com>:

      The next one is about scopes in file: jdk8/jdk/src/share/sample/scripting/scriptpad/src/resources/scriptpad.js. I removed everything unimportant and the following code snippet show the problem:

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

      with (guiPkgs) {
         function main() {
             function createFrame() {
                 var frame = new JFrame();
             }

             createFrame();
         }
      }

      main();

      ------

      'created' should come out but JFrame is unknown. I tested this with some browsers (Firefox, Safari, Chrome) but only Rhino and Firefox can handle that construct.

      Attachments

        Activity

          People

            sundar Sundararajan Athijegannathan
            jlaskey Jim Laskey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: