8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs

Reviewed-by: jlaskey, hannesw
This commit is contained in:
Athijegannathan Sundararajan 2018-06-28 18:04:19 +05:30
parent 271a76877a
commit 724ba7feb2
87 changed files with 333 additions and 5 deletions

View File

@ -345,10 +345,12 @@ jdk.jartool_ADD_JAVAC_FLAGS += -XDstringConcat=inline
################################################################################
jdk.scripting.nashorn_ADD_JAVAC_FLAGS += $(DISABLE_WARNINGS),-overrides
jdk.scripting.nashorn_COPY := .properties .js
################################################################################
jdk.scripting.nashorn.shell_ADD_JAVAC_FLAGS += $(DISABLE_WARNINGS),-overrides
jdk.scripting.nashorn.shell_COPY += .js .properties
################################################################################

View File

@ -371,6 +371,7 @@ run.test.jvmargs.common=\
-Duser.language=${run.test.user.language} \
-Duser.country=${run.test.user.country} \
-Dnashorn.typeInfo.cacheDir=${build.dir}${file.separator}test${file.separator}type_info_cache \
-Dnashorn.args.prepend=--no-deprecation-warning \
${jfr.args} \
-XX:+HeapDumpOnOutOfMemoryError

View File

@ -60,6 +60,7 @@ import jdk.nashorn.tools.Shell;
/**
* Interactive command line Shell for Nashorn.
*/
@Deprecated(since="11", forRemoval=true)
public final class Main extends Shell {
private Main() {}

View File

@ -37,6 +37,7 @@
* @moduleGraph
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
module jdk.scripting.nashorn.shell {
requires static java.compiler;
requires jdk.internal.le;

View File

@ -42,6 +42,7 @@ import jdk.nashorn.internal.runtime.linker.Bootstrap;
* can use the linkers exported by this provider to support tight integration
* of Nashorn objects.
*/
@Deprecated(since="11", forRemoval=true)
public final class NashornLinkerExporter extends GuardingDynamicLinkerExporter {
/**
* The default constructor.

View File

@ -38,8 +38,12 @@ import java.util.Set;
* operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
* to appropriate method call of this class.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public abstract class AbstractJSObject implements JSObject {
/**
* The default constructor.

View File

@ -29,8 +29,12 @@ package jdk.nashorn.api.scripting;
* jsr-223 program embedding nashorn script can set ClassFilter instance
* to be used when an engine instance is created.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public interface ClassFilter {
/**
* Should the Java class of the specified name be exposed to scripts?

View File

@ -35,8 +35,12 @@ import jdk.nashorn.internal.runtime.JSType;
* operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
* to appropriate method call of this interface.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public interface JSObject {
/**
* Call this object as a JavaScript function. This is equivalent to

View File

@ -42,8 +42,12 @@ import jdk.nashorn.internal.runtime.ScriptObject;
* interface. In these cases, user code will get an instance of this or
* implementation defined subclass.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
@SuppressWarnings("serial")
public abstract class NashornException extends RuntimeException {
private static final long serialVersionUID = 1L;

View File

@ -67,8 +67,12 @@ import jdk.nashorn.internal.runtime.options.Options;
* {@link Invocable} interfaces, allowing for efficient precompilation and repeated execution of scripts.
* @see NashornScriptEngineFactory
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public final class NashornScriptEngine extends AbstractScriptEngine implements Compilable, Invocable {
/**
* Key used to associate Nashorn global object mirror with arbitrary Bindings instance.
@ -135,6 +139,10 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
}
}, CREATE_CONTEXT_ACC_CTXT);
if (!nashornContext.getEnv()._no_deprecation_warning) {
System.err.println("Warning: Nashorn engine is planned to be removed from a future JDK release");
}
// cache this option that is used often
this._global_per_engine = nashornContext.getEnv()._global_per_engine;

View File

@ -46,8 +46,12 @@ import jdk.nashorn.internal.runtime.Version;
* Programs executing in engines created using {@link #getScriptEngine(String[])} will have the passed arguments
* accessible as a global variable named {@code "arguments"}.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public final class NashornScriptEngineFactory implements ScriptEngineFactory {
@Override
public String getEngineName() {

View File

@ -58,8 +58,12 @@ import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
/**
* Mirror object that wraps a given Nashorn Script object.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public final class ScriptObjectMirror extends AbstractJSObject implements Bindings {
private static AccessControlContext getContextAccCtxt() {
final Permissions perms = new Permissions();

View File

@ -37,8 +37,12 @@ import jdk.nashorn.internal.runtime.linker.Bootstrap;
/**
* Utilities that are to be called from script code.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public final class ScriptUtils {
private ScriptUtils() {}

View File

@ -37,8 +37,12 @@ import jdk.nashorn.internal.runtime.Source;
* A Reader that reads from a URL. Used to make sure that the reader
* reads content from given URL and can be trusted to do so.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 1.8u40
*/
@Deprecated(since="11", forRemoval=true)
public final class URLReader extends Reader {
// underlying URL
private final URL url;

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>expression</em> [ <em>index</em> ]
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ArrayAccessTree extends ExpressionTree {
/**
* Returns the array that is accessed.

View File

@ -30,8 +30,12 @@ import java.util.List;
/**
* Represents ECMAScript array literal expression.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ArrayLiteralTree extends ExpressionTree {
/**
* Returns the list of Array element expressions.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>variable</em> = <em>expression</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface AssignmentTree extends ExpressionTree {
/**
* Returns the left hand side (LHS) of this assignment.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>leftOperand</em> <em>operator</em> <em>rightOperand</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface BinaryTree extends ExpressionTree {
/**
* Returns left hand side (LHS) of this binary expression.

View File

@ -37,8 +37,12 @@ import java.util.List;
* { <em>statements</em> }
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface BlockTree extends StatementTree {
/**
* Returns the list of statements in this block.

View File

@ -35,8 +35,12 @@ package jdk.nashorn.api.tree;
* break <em>label</em> ;
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface BreakTree extends GotoTree {
/**
* Label associated with this break statement. This is null

View File

@ -39,8 +39,12 @@ import java.util.List;
* <em>statements</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface CaseTree extends Tree {
/**
* Case expression of this 'case' statement.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>block</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface CatchTree extends Tree {
/**
* Returns the catch parameter identifier or parameter binding pattern of the exception caught.

View File

@ -29,8 +29,12 @@ import java.util.List;
/**
* A tree node that represents a <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-class-definitions">class declaration</a>.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ClassDeclarationTree extends StatementTree {
/**

View File

@ -30,8 +30,12 @@ import java.util.List;
/**
* A tree node that represents a <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-class-definitions">class expression</a>.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ClassExpressionTree extends ExpressionTree {
/**
* Class identifier. Optional.

View File

@ -31,8 +31,12 @@ import java.util.List;
* Represents the abstract syntax tree for compilation units (source
* files)
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface CompilationUnitTree extends Tree {
/**
* Return the list of source elements in this compilation unit.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>variable</em> <em>operator</em> <em>expression</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface CompoundAssignmentTree extends ExpressionTree {
/**
* Returns the left hand side (LHS) of this assignment.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>condition</em> ? <em>trueExpression</em> : <em>falseExpression</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ConditionalExpressionTree extends ExpressionTree {
/**
* Returns the condition expression of this ternary expression.

View File

@ -28,8 +28,12 @@ package jdk.nashorn.api.tree;
/**
* A mixin for conditional "loop" statements.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ConditionalLoopTree extends LoopTree {
/**
* Returns the condition expression of this 'loop' statement.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* continue <em>label</em> ;
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ContinueTree extends GotoTree {
/**
* Label associated with this continue statement. This is null

View File

@ -33,7 +33,11 @@ package jdk.nashorn.api.tree;
* <em>debugger;</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface DebuggerTree extends StatementTree {
}

View File

@ -40,8 +40,12 @@ package jdk.nashorn.api.tree;
* <p>Line terminator is as defined in ECMAScript specification which is one
* of { &#92;u000A, &#92;u000B, &#92;u2028, &#92;u2029 }.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface Diagnostic {
/**
@ -55,7 +59,11 @@ public interface Diagnostic {
* should imply any inherent semantic meaning to the message
* of the diagnostic: for example, a tool might provide an
* option to report all warnings as errors.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*/
@Deprecated(since="11", forRemoval=true)
enum Kind {
/**
* Problem which prevents the tool's normal completion.

View File

@ -28,8 +28,12 @@ package jdk.nashorn.api.tree;
/**
* Interface for receiving diagnostics from Nashorn parser.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
@FunctionalInterface
public interface DiagnosticListener {
/**

View File

@ -35,8 +35,12 @@ package jdk.nashorn.api.tree;
* while ( <em>expression</em> );
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface DoWhileLoopTree extends ConditionalLoopTree {
/**
* Returns the condition expression of this do-while statement.

View File

@ -33,6 +33,10 @@ package jdk.nashorn.api.tree;
* ;
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface EmptyStatementTree extends StatementTree {}

View File

@ -28,7 +28,11 @@ package jdk.nashorn.api.tree;
/**
* A tree node to stand in for a malformed expression.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ErroneousTree extends ExpressionTree {
}

View File

@ -28,7 +28,11 @@ import java.util.List;
/**
* A Tree node for export entry in <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-modules">Module information</a>.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*/
@Deprecated(since="11", forRemoval=true)
public interface ExportEntryTree extends Tree {
/**
* Returns the entry's export name.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>expression</em> ;
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ExpressionStatementTree extends StatementTree {
/**
* Returns the expression of this expression statement.

View File

@ -29,6 +29,10 @@ package jdk.nashorn.api.tree;
* A tree node used as the base class for the different types of
* expressions.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ExpressionTree extends Tree {}

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>statement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ForInLoopTree extends LoopTree {
/**
* The for..in left hand side expression.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>statement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ForLoopTree extends ConditionalLoopTree {
/**
* Returns the initializer expression of this 'for' statement.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>statement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ForOfLoopTree extends LoopTree {
/**
* The for..of left hand side expression.

View File

@ -37,8 +37,12 @@ import java.util.List;
* this . <em>identifier</em> ( <em>arguments</em> )
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface FunctionCallTree extends ExpressionTree {
/**
* Returns the function being called.

View File

@ -43,8 +43,12 @@ import java.util.List;
* <em>body</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface FunctionDeclarationTree extends StatementTree {
/**
* Returns the name of the function being declared.

View File

@ -41,8 +41,12 @@ import java.util.List;
* <em>var</em> func = <em>(x) =&gt; x+1</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface FunctionExpressionTree extends ExpressionTree {
/**
* Returns the name of the function being declared.

View File

@ -31,8 +31,12 @@ package jdk.nashorn.api.tree;
* type serves as a super interface for {@link BreakTree} and
* {@link ContinueTree}.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface GotoTree extends StatementTree {
/**
* Label associated with this goto statement. This is null

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>name</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface IdentifierTree extends ExpressionTree {
/**
* Returns the name of this identifier.

View File

@ -39,8 +39,12 @@ package jdk.nashorn.api.tree;
* <em>elseStatement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface IfTree extends StatementTree {
/**
* Returns the condition expression of this 'if' statement.

View File

@ -28,7 +28,11 @@ import java.util.List;
/**
* A Tree node for import entry of <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-modules">Module information</a>.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*/
@Deprecated(since="11", forRemoval=true)
public interface ImportEntryTree extends Tree {
/**
* Returns the entry's module request.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>expression</em> instanceof <em>type</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface InstanceOfTree extends ExpressionTree {
/**
* Returns the expression whose type is being checked.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>label</em> : <em>statement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface LabeledStatementTree extends StatementTree {
/**
* Returns the label associated with this statement.

View File

@ -29,8 +29,12 @@ package jdk.nashorn.api.tree;
* Provides methods to convert between character positions and line numbers
* for a compilation unit.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface LineMap {
/**
* Find the line containing a position; a line termination

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>value</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface LiteralTree extends ExpressionTree {
/**
* Returns the value of this literal.

View File

@ -28,8 +28,12 @@ package jdk.nashorn.api.tree;
/**
* A mixin for "loop" statements.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface LoopTree extends StatementTree {
/**
* Returns the statement contained in this 'loop' statement.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* <em>expression</em> . <em>identifier</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface MemberSelectTree extends ExpressionTree {
/**
* The object expression whose member is being selected.

View File

@ -28,7 +28,11 @@ import java.util.List;
/**
* A Tree node for <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-modules">Module information</a>.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*/
@Deprecated(since="11", forRemoval=true)
public interface ModuleTree extends Tree {
/**
* Returns the list of import entries.

View File

@ -35,8 +35,12 @@ package jdk.nashorn.api.tree;
* new <em>identifier</em> ( <em>arguments</em> )
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface NewTree extends ExpressionTree {
/**
* Returns the constructor expression of this 'new' expression.

View File

@ -30,8 +30,12 @@ import java.util.List;
/**
* Represents ECMAScript object literal expression.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ObjectLiteralTree extends ExpressionTree {
/**
* Returns the list of properties of this object literal.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* ( <em>expression</em> )
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ParenthesizedTree extends ExpressionTree {
/**
* Returns the expression within the parenthesis.

View File

@ -36,8 +36,12 @@ import jdk.nashorn.api.scripting.ScriptObjectMirror;
/**
* Represents nashorn ECMAScript parser instance.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface Parser {
/**
* Parses the source file and returns compilation unit tree

View File

@ -28,8 +28,12 @@ package jdk.nashorn.api.tree;
/**
* To represent property setting in an object literal tree.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface PropertyTree extends Tree {
/**
* Returns the name of this property.

View File

@ -28,8 +28,12 @@ package jdk.nashorn.api.tree;
/**
* Represents regular expression literal in the source code.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface RegExpLiteralTree extends ExpressionTree {
/**
* Regular expression pattern to match.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* return <em>expression</em>;
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ReturnTree extends StatementTree {
/**
* Returns the expression being returned. This is null if no value

View File

@ -40,12 +40,16 @@ package jdk.nashorn.api.tree;
* subclasses with {@link java.lang.Override @Override} will help
* ensure that methods are overridden as intended.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
* methods. Use {@code Void} for visitors that do not need an
* additional parameter.
*/
@Deprecated(since="11", forRemoval=true)
public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
@Override
public R visitAssignment(final AssignmentTree node, final P r) {

View File

@ -42,12 +42,16 @@ import java.util.List;
* subclasses with {@link java.lang.Override @Override} will help
* ensure that methods are overridden as intended.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
* methods. Use {@code Void} for visitors that do not need an
* additional parameter.
*/
@Deprecated(since="11", forRemoval=true)
public class SimpleTreeVisitorES6<R, P> extends SimpleTreeVisitorES5_1<R, P> {
@Override
public R visitCompilationUnit(final CompilationUnitTree node, final P r) {

View File

@ -27,7 +27,11 @@ package jdk.nashorn.api.tree;
/**
* A tree node for spread operator in array elements, function call arguments.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*/
@Deprecated(since="11", forRemoval=true)
public interface SpreadTree extends ExpressionTree {
/**
* Returns the expression that is being spread.

View File

@ -29,7 +29,11 @@ package jdk.nashorn.api.tree;
* A tree node used as the base class for the different kinds of
* statements.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface StatementTree extends Tree {
}

View File

@ -37,8 +37,12 @@ import java.util.List;
* }
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface SwitchTree extends StatementTree {
/**
* Returns the expression on which this statement switches.

View File

@ -35,9 +35,13 @@ import java.util.List;
* `This is a String with ${computed} values in it`
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*
*/
@Deprecated(since="11", forRemoval=true)
public interface TemplateLiteralTree extends ExpressionTree {
/**
* Returns the list of expressions in this template string

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* throw <em>expression</em>;
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface ThrowTree extends StatementTree {
/**
* Returns the expression being thrown.

View File

@ -31,13 +31,21 @@ package jdk.nashorn.api.tree;
* <p><b>WARNING:</b> This interface and its sub-interfaces are
* subject to change as the ECMAScript programming language evolves.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface Tree {
/**
* Enumerates all kinds of trees.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*/
@Deprecated(since="11", forRemoval=true)
public enum Kind {
/**
* Used for instances of {@link ArrayAccessTree}.

View File

@ -45,6 +45,9 @@ package jdk.nashorn.api.tree;
default method bodies will be introduced which will call visitUnknown
method as a fallback.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
@ -53,6 +56,7 @@ package jdk.nashorn.api.tree;
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface TreeVisitor<R,P> {
/**
* Visit assignment tree.

View File

@ -39,8 +39,12 @@ import java.util.List;
* <em>finallyBlock</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface TryTree extends StatementTree {
/**
* Returns the 'try' block of this 'try' statement.

View File

@ -36,8 +36,12 @@ package jdk.nashorn.api.tree;
* <em>expression</em> <em>operator</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface UnaryTree extends ExpressionTree {
/**
* Returns the expression operated by the unary operator.

View File

@ -33,8 +33,12 @@ package jdk.nashorn.api.tree;
* {@linkplain TreeVisitor tree visitor} to indicate that the
* visitor was created for a prior version of the language.
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public class UnknownTreeException extends RuntimeException {
private static final long serialVersionUID = 1L;

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>var</em> <em>binding_pattern</em> [ <em>initializer</em> ];
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface VariableTree extends StatementTree {
/**
* Returns the binding of this declaration. This is an {@link IdentifierTree}

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>statement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface WhileLoopTree extends ConditionalLoopTree {
/**
* The condition expression of this 'while' statement.

View File

@ -34,8 +34,12 @@ package jdk.nashorn.api.tree;
* <em>statement</em>
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface WithTree extends StatementTree {
/**
* The scope object expression for this 'with' statement.

View File

@ -37,8 +37,12 @@ package jdk.nashorn.api.tree;
* }
* </pre>
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
public interface YieldTree extends ExpressionTree {
/**
* Returns the expression that is yielded.

View File

@ -108,6 +108,8 @@ public final class ScriptEnvironment {
/** Enable experimental ECMAScript 6 features. */
public final boolean _es6;
/** do not show deprecation warning for nashorn engine and jjs usage. */
public final boolean _no_deprecation_warning;
/** Number of times a dynamic call site has to be relinked before it is
* considered unstable (and thus should be linked as if it were megamorphic).
@ -306,6 +308,7 @@ public final class ScriptEnvironment {
_strict = options.getBoolean("strict");
_version = options.getBoolean("version");
_verify_code = options.getBoolean("verify.code");
_no_deprecation_warning = options.getBoolean("no.deprecation.warning");
final int configuredUrt = options.getInteger("unstable.relink.threshold");
// The default for this property is -1, so we can easily detect when

View File

@ -223,6 +223,14 @@ nashorn.option.log = { \
type=Log \
}
nashorn.option.no.deprecation.warning = { \
name="--no-deprecation-warning", \
type=Boolean, \
default=false, \
desc="Do not show nashorn deprecation warning." \
}
nashorn.option.lazy.compilation = { \
name="--lazy-compilation", \
is_undocumented=true, \

View File

@ -170,6 +170,9 @@ public class Shell implements PartialParser {
final Global global = context.createGlobal();
final ScriptEnvironment env = context.getEnv();
if (!env._no_deprecation_warning) {
System.err.println("Warning: The jjs tool is planned to be removed from a future JDK release");
}
final List<String> files = env.getFiles();
if (files.isEmpty()) {
return readEvalPrint(context, global);

View File

@ -135,10 +135,14 @@ ScriptEngine nashornEngine = new ScriptEngineManager().getEngineByName("nashorn"
* non-standard built-in objects:
* {@code JSAdapter}, {@code JavaImporter}, {@code Packages}
*
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
* are deprecated with the intent to remove them in a future release.
*
* @provides javax.script.ScriptEngineFactory
* @moduleGraph
* @since 9
*/
@Deprecated(since="11", forRemoval=true)
module jdk.scripting.nashorn {
requires java.logging;
requires jdk.dynalink;

View File

@ -42,7 +42,7 @@ fi
# -e option with JavaScript explicitly choosen as language
rm -f jrunscript-eTest.out 2>/dev/null
${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn -e "println('hello')" > jrunscript-eTest.out 2>&1
${JRUNSCRIPT} -J-Dnashorn.args.prepend=--no-deprecation-warning -J-Djava.awt.headless=true -l nashorn -e "println('hello')" > jrunscript-eTest.out 2>&1
$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
if [ $? != 0 ]

View File

@ -43,7 +43,7 @@ fi
# with -l option
rm -f jrunscript-fTest.out 2>/dev/null
${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
${JRUNSCRIPT} -J-Dnashorn.args.prepend=--no-deprecation-warning -J-Djava.awt.headless=true -l nashorn -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
if [ $? != 0 ]

View File

@ -40,7 +40,7 @@ if [ $? -eq 2 ]; then
fi
rm -f jrunscriptTest.out 2>/dev/null
${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn > jrunscriptTest.out 2>&1 <<EOF
${JRUNSCRIPT} -J-Dnashorn.args.prepend=--no-deprecation-warning -J-Djava.awt.headless=true -l nashorn > jrunscriptTest.out 2>&1 <<EOF
v = 2 + 5;
v *= 5; v.doubleValue();
v = v + " is the value";

View File

@ -35,7 +35,7 @@
setup
rm -f jjs-fileTest.out 2>/dev/null
${JJS} -J-Djava.security.manager ${TESTSRC}/file.js > jjs-fileTest.out 2>&1
${JJS} --no-deprecation-warning -J-Djava.security.manager ${TESTSRC}/file.js > jjs-fileTest.out 2>&1
$golden_diff jjs-fileTest.out ${TESTSRC}/file.out
if [ $? != 0 ]

View File

@ -54,6 +54,6 @@ var emptyFile = new File($ENV.PWD+File.separator+"empty.js");
emptyFile.createNewFile();
emptyFile.deleteOnExit();
$EXEC(jjsCmd + " empty.js");
$EXEC(jjsCmd + " --no-deprecation-warning empty.js");
if($ERR != "")
fail("jjs fails with empty script file");