Skip to content

Commit

Permalink
8204492: Add deprecation annotation to Nashorn APIs and warning to na…
Browse files Browse the repository at this point in the history
…shorn, jjs

Reviewed-by: jlaskey, hannesw
  • Loading branch information
sundararajana committed Jun 28, 2018
1 parent b12627f commit 2c08386
Show file tree
Hide file tree
Showing 82 changed files with 327 additions and 1 deletion.
1 change: 1 addition & 0 deletions make/nashorn/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
/**
* Interactive command line Shell for Nashorn.
*/
@Deprecated(since="11", forRemoval=true)
public final class Main extends Shell {
private Main() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
* 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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@
* {@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.
Expand Down Expand Up @@ -135,6 +139,10 @@ public Context run() {
}
}, 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@
* 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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@
/**
* 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
/**
* 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() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
* { <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
/**
* 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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
* <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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
* <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 {
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
* <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 {

/**
Expand All @@ -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.
Expand Down
Loading

0 comments on commit 2c08386

Please sign in to comment.