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

scriptengine/javascript accessor definition not supported anymore

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_23"
      Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.6.38-10-generic-pae #46-Ubuntu SMP Tue Jun 28 16:54:49 UTC 2011 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      This javascript expression works with jdk1.6.0_22 but will not work with jdk1.6.0_23 and 1.6.0_26 :

      var v = {get value() {return 3;}};

      with jdk1.6.0_23, this expression will throw the following exception :

      Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: missing : after property id (<Unknown source>#1) in <Unknown source> at line number 1

      REGRESSION. Last worked in version 6

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the following code and run it :

      import javax.script.ScriptEngine;
      import javax.script.ScriptEngineManager;

      public class JsRegression {
        public static void main(String[] args) throws Exception {
          ScriptEngineManager manager = new ScriptEngineManager();
          ScriptEngine engine = manager.getEngineByName("ecmascript");

          System.err.println("ENGINE VERSION " + engine.getFactory().getEngineVersion());
          engine.eval("var v = {get value() {return 3;}};");
        }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      with jdk1.6.0_22 this program succeeds :

      $> java JsRegression
      ENGINE VERSION 1.6 release 2
      ACTUAL -
      with jdk1.6.0_26 (and also jdk1.6.0_23) this program fails :

      $>java JsRegression
      ENGINE VERSION 1.6 release 2
      Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: missing : after property id (<Unknown source>#1) in <Unknown source> at line number 1
              at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:110)
              at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:124)
              at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
              at JsRegression.main(JsRegression.java:10)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.script.ScriptEngine;
      import javax.script.ScriptEngineManager;

      public class JsRegression {
        public static void main(String[] args) throws Exception {
          ScriptEngineManager manager = new ScriptEngineManager();
          ScriptEngine engine = manager.getEngineByName("ecmascript");

          System.err.println("ENGINE VERSION " + engine.getFactory().getEngineVersion());
          engine.eval("var v = {get value() {return 3;}};");
        }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: