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

JavaScript scope (Bindings) implementation is broken

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 6
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b63
    • CPU:
      generic
    • OS:
      generic

      Description

      import javax.script.*;

      public class t {
              public static void main(String[] args) throws Exception {
                      ScriptEngineManager m = new ScriptEngineManager();
                      ScriptEngine e = m.getEngineByName("js");
                      e.eval("var v = 'hello'");
                      Bindings b = e.createBindings();
                      // b is newly created scope. We don't expect 'v' in it...
                      // we expect 'b' to be empty
                      for (String s: b.keySet())
                          System.out.println(s);
              }
      }

      Running the above program prints

      context
      print
      v

      This is not expected. The newly created scope somehow gets the values created in default engine scope of the JavaScript engine. This should not happen.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: