src/jdk/nashorn/api/scripting/ScriptUtils.java

Print this page
rev 1131 : 8068431: @since and @jdk.Exported are missing in jdk.nashorn.api.scripting classes and package-info.java files
Reviewed-by: attila, lagergren


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.api.scripting;
  27 
  28 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
  29 
  30 import java.lang.invoke.MethodHandle;
  31 import jdk.internal.dynalink.beans.StaticClass;
  32 import jdk.internal.dynalink.linker.LinkerServices;
  33 import jdk.nashorn.internal.runtime.Context;
  34 import jdk.nashorn.internal.runtime.ScriptFunction;
  35 import jdk.nashorn.internal.runtime.ScriptObject;
  36 import jdk.nashorn.internal.runtime.ScriptRuntime;
  37 import jdk.nashorn.internal.runtime.linker.Bootstrap;
  38 
  39 /**
  40  * Utilities that are to be called from script code.


  41  */

  42 public final class ScriptUtils {
  43     private ScriptUtils() {}
  44 
  45     /**
  46      * Returns AST as JSON compatible string. This is used to
  47      * implement "parse" function in resources/parse.js script.
  48      *
  49      * @param code code to be parsed
  50      * @param name name of the code source (used for location)
  51      * @param includeLoc tells whether to include location information for nodes or not
  52      * @return JSON string representation of AST of the supplied code
  53      */
  54     public static String parse(final String code, final String name, final boolean includeLoc) {
  55         return ScriptRuntime.parse(code, name, includeLoc);
  56     }
  57 
  58     /**
  59      * Method which converts javascript types to java types for the
  60      * String.format method (jrunscript function sprintf).
  61      *




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.api.scripting;
  27 
  28 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
  29 
  30 import java.lang.invoke.MethodHandle;
  31 import jdk.internal.dynalink.beans.StaticClass;
  32 import jdk.internal.dynalink.linker.LinkerServices;
  33 import jdk.nashorn.internal.runtime.Context;
  34 import jdk.nashorn.internal.runtime.ScriptFunction;
  35 import jdk.nashorn.internal.runtime.ScriptObject;
  36 import jdk.nashorn.internal.runtime.ScriptRuntime;
  37 import jdk.nashorn.internal.runtime.linker.Bootstrap;
  38 
  39 /**
  40  * Utilities that are to be called from script code.
  41  *
  42  * @since 1.8u40
  43  */
  44 @jdk.Exported
  45 public final class ScriptUtils {
  46     private ScriptUtils() {}
  47 
  48     /**
  49      * Returns AST as JSON compatible string. This is used to
  50      * implement "parse" function in resources/parse.js script.
  51      *
  52      * @param code code to be parsed
  53      * @param name name of the code source (used for location)
  54      * @param includeLoc tells whether to include location information for nodes or not
  55      * @return JSON string representation of AST of the supplied code
  56      */
  57     public static String parse(final String code, final String name, final boolean includeLoc) {
  58         return ScriptRuntime.parse(code, name, includeLoc);
  59     }
  60 
  61     /**
  62      * Method which converts javascript types to java types for the
  63      * String.format method (jrunscript function sprintf).
  64      *