8009263: Fix all javadoc errors in nashorn code
Reviewed-by: hannesw, lagergren
This commit is contained in:
parent
bd2109d3fa
commit
1909e5f9d6
nashorn
make
src/jdk/nashorn/internal
codegen
ir
objects
runtime
@ -24,7 +24,7 @@
|
||||
application.title=nashorn
|
||||
|
||||
# location of JDK embedded ASM sources
|
||||
jdk.asm.src.dir=../jdk/src/share/classes/jdk/internal
|
||||
jdk.asm.src.dir=../jdk/src/share/classes/jdk/internal/org/objectweb/asm
|
||||
|
||||
# source and target levels
|
||||
build.compiler=modern
|
||||
|
@ -95,7 +95,7 @@ import jdk.nashorn.internal.runtime.Source;
|
||||
* <p>
|
||||
* There is also a very nice debug interface that can emit formatted
|
||||
* bytecodes that have been written. This is enabled by setting the
|
||||
* environment "nashorn.codegen.debug" to true, or --log=codegen:<level>
|
||||
* environment "nashorn.codegen.debug" to true, or --log=codegen:{@literal <level>}
|
||||
* <p>
|
||||
* A ClassEmitter implements an Emitter - i.e. it needs to have
|
||||
* well defined start and end calls for whatever it is generating. Assertions
|
||||
|
@ -112,7 +112,7 @@ public final class ObjectClassGenerator {
|
||||
private final Context context;
|
||||
|
||||
/**
|
||||
* The list of available accessor types in width order. This order is used for type guesses narrow->wide
|
||||
* The list of available accessor types in width order. This order is used for type guesses narrow{@literal ->} wide
|
||||
* in the dual--fields world
|
||||
*/
|
||||
public static final List<Type> ACCESSOR_TYPES = Collections.unmodifiableList(
|
||||
@ -184,7 +184,7 @@ public final class ObjectClassGenerator {
|
||||
|
||||
/**
|
||||
* Return the accessor type based on its index in [0..getNumberOfAccessorTypes())
|
||||
* Indexes are ordered narrower->wider / optimistic->pessimistic. Invalidations always
|
||||
* Indexes are ordered narrower{@literal ->}wider / optimistic{@literal ->}pessimistic. Invalidations always
|
||||
* go to a type of higher index
|
||||
*
|
||||
* @param index accessor type index
|
||||
|
@ -459,120 +459,120 @@ public final class RuntimeCallSite extends MutableCallSite {
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of < operator for two int arguments. Do not call directly.
|
||||
* Specialized version of {@literal <} operator for two int arguments. Do not call directly.
|
||||
* @param a int
|
||||
* @param b int
|
||||
* @return a < b
|
||||
* @return a {@code <} b
|
||||
*/
|
||||
public static boolean LT(final int a, final int b) {
|
||||
return a < b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of < operator for two double arguments. Do not call directly.
|
||||
* Specialized version of {@literal <} operator for two double arguments. Do not call directly.
|
||||
* @param a double
|
||||
* @param b double
|
||||
* @return a < b
|
||||
* @return a {@literal <} b
|
||||
*/
|
||||
public static boolean LT(final double a, final double b) {
|
||||
return a < b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of < operator for two long arguments. Do not call directly.
|
||||
* Specialized version of {@literal <} operator for two long arguments. Do not call directly.
|
||||
* @param a long
|
||||
* @param b long
|
||||
* @return a < b
|
||||
* @return a {@literal <} b
|
||||
*/
|
||||
public static boolean LT(final long a, final long b) {
|
||||
return a < b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of <= operator for two int arguments. Do not call directly.
|
||||
* Specialized version of {@literal <=} operator for two int arguments. Do not call directly.
|
||||
* @param a int
|
||||
* @param b int
|
||||
* @return a <= b
|
||||
* @return a {@literal <=} b
|
||||
*/
|
||||
public static boolean LE(final int a, final int b) {
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of <= operator for two double arguments. Do not call directly.
|
||||
* Specialized version of {@literal <=} operator for two double arguments. Do not call directly.
|
||||
* @param a double
|
||||
* @param b double
|
||||
* @return a <= b
|
||||
* @return a {@literal <=} b
|
||||
*/
|
||||
public static boolean LE(final double a, final double b) {
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of <= operator for two long arguments. Do not call directly.
|
||||
* Specialized version of {@literal <=} operator for two long arguments. Do not call directly.
|
||||
* @param a long
|
||||
* @param b long
|
||||
* @return a <= b
|
||||
* @return a {@literal <=} b
|
||||
*/
|
||||
public static boolean LE(final long a, final long b) {
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of > operator for two int arguments. Do not call directly.
|
||||
* Specialized version of {@literal >} operator for two int arguments. Do not call directly.
|
||||
* @param a int
|
||||
* @param b int
|
||||
* @return a > b
|
||||
* @return a {@literal >} b
|
||||
*/
|
||||
public static boolean GT(final int a, final int b) {
|
||||
return a > b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of > operator for two double arguments. Do not call directly.
|
||||
* Specialized version of {@literal >} operator for two double arguments. Do not call directly.
|
||||
* @param a double
|
||||
* @param b double
|
||||
* @return a > b
|
||||
* @return a {@literal >} b
|
||||
*/
|
||||
public static boolean GT(final double a, final double b) {
|
||||
return a > b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of > operator for two long arguments. Do not call directly.
|
||||
* Specialized version of {@literal >} operator for two long arguments. Do not call directly.
|
||||
* @param a long
|
||||
* @param b long
|
||||
* @return a > b
|
||||
* @return a {@literal >} b
|
||||
*/
|
||||
public static boolean GT(final long a, final long b) {
|
||||
return a > b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of >= operator for two int arguments. Do not call directly.
|
||||
* Specialized version of {@literal >=} operator for two int arguments. Do not call directly.
|
||||
* @param a int
|
||||
* @param b int
|
||||
* @return a >= b
|
||||
* @return a {@literal >=} b
|
||||
*/
|
||||
public static boolean GE(final int a, final int b) {
|
||||
return a >= b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of >= operator for two double arguments. Do not call directly.
|
||||
* Specialized version of {@literal >=} operator for two double arguments. Do not call directly.
|
||||
* @param a double
|
||||
* @param b double
|
||||
* @return a >= b
|
||||
* @return a {@literal >=} b
|
||||
*/
|
||||
public static boolean GE(final double a, final double b) {
|
||||
return a >= b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized version of >= operator for two long arguments. Do not call directly.
|
||||
* Specialized version of {@literal >=} operator for two long arguments. Do not call directly.
|
||||
* @param a long
|
||||
* @param b long
|
||||
* @return a >= b
|
||||
* @return a {@code >=} b
|
||||
*/
|
||||
public static boolean GE(final long a, final long b) {
|
||||
return a >= b;
|
||||
|
@ -64,17 +64,17 @@ public class RuntimeNode extends Node implements TypeOverride {
|
||||
EQ_STRICT(TokenType.EQ_STRICT, Type.BOOLEAN, 2, true),
|
||||
/** == operator with at least one object */
|
||||
EQ(TokenType.EQ, Type.BOOLEAN, 2, true),
|
||||
/** >= operator with at least one object */
|
||||
/** {@literal >=} operator with at least one object */
|
||||
GE(TokenType.GE, Type.BOOLEAN, 2, true),
|
||||
/** > operator with at least one object */
|
||||
/** {@literal >} operator with at least one object */
|
||||
GT(TokenType.GT, Type.BOOLEAN, 2, true),
|
||||
/** in operator */
|
||||
IN(TokenType.IN, Type.BOOLEAN, 2),
|
||||
/** instanceof operator */
|
||||
INSTANCEOF(TokenType.INSTANCEOF, Type.BOOLEAN, 2),
|
||||
/** <= operator with at least one object */
|
||||
/** {@literal <=} operator with at least one object */
|
||||
LE(TokenType.LE, Type.BOOLEAN, 2, true),
|
||||
/** < operator with at least one object */
|
||||
/** {@literal <} operator with at least one object */
|
||||
LT(TokenType.LT, Type.BOOLEAN, 2, true),
|
||||
/** !== operator with at least one object */
|
||||
NE_STRICT(TokenType.NE_STRICT, Type.BOOLEAN, 2, true),
|
||||
@ -184,7 +184,7 @@ public class RuntimeNode extends Node implements TypeOverride {
|
||||
|
||||
/**
|
||||
* If this request can be reversed, return the reverse request
|
||||
* Eq EQ -> NE.
|
||||
* Eq EQ {@literal ->} NE.
|
||||
*
|
||||
* @param request request to reverse
|
||||
*
|
||||
|
@ -542,7 +542,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering && operator
|
||||
* Binary enter - callback for entering {@literal &&} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -552,7 +552,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving a && operator
|
||||
* Binary leave - callback for leaving a {@literal &&} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -602,7 +602,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering &= operator
|
||||
* Binary enter - callback for entering {@literal &=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -612,7 +612,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving a &= operator
|
||||
* Binary leave - callback for leaving a {@literal &=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -722,7 +722,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering >>= operator
|
||||
* Binary enter - callback for entering {@literal >>=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -732,7 +732,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving a >>= operator
|
||||
* Binary leave - callback for leaving a {@literal >>=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -742,7 +742,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering a <<= operator
|
||||
* Binary enter - callback for entering a {@literal <<=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -752,7 +752,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving a <<= operator
|
||||
* Binary leave - callback for leaving a {@literal <<=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -762,7 +762,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering >>>= operator
|
||||
* Binary enter - callback for entering {@literal >>>=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -772,7 +772,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving a >>>= operator
|
||||
* Binary leave - callback for leaving a {@literal >>>=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -822,7 +822,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering & operator
|
||||
* Binary enter - callback for entering {@literal &} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -832,7 +832,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving a & operator
|
||||
* Binary leave - callback for leaving a {@literal &} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -986,7 +986,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering >= operator
|
||||
* Binary enter - callback for entering {@literal >=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -996,7 +996,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving >= operator
|
||||
* Binary leave - callback for leaving {@literal >=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -1006,7 +1006,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering > operator
|
||||
* Binary enter - callback for entering {@literal >} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -1016,7 +1016,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving > operator
|
||||
* Binary leave - callback for leaving {@literal >} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -1066,7 +1066,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering <= operator
|
||||
* Binary enter - callback for entering {@literal <=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -1076,7 +1076,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving <= operator
|
||||
* Binary leave - callback for leaving {@literal <=} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -1086,7 +1086,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering < operator
|
||||
* Binary enter - callback for entering {@literal <} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -1096,7 +1096,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving < operator
|
||||
* Binary leave - callback for leaving {@literal <} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -1205,7 +1205,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering >> operator
|
||||
* Binary enter - callback for entering {@literal >>} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -1215,7 +1215,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving >> operator
|
||||
* Binary leave - callback for leaving {@literal >>} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -1225,7 +1225,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary enter - callback for entering << operator
|
||||
* Binary enter - callback for entering {@literal <<} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -1235,7 +1235,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving << operator
|
||||
* Binary leave - callback for leaving {@literal <<} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
@ -1244,7 +1244,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
return leaveDefault(binaryNode);
|
||||
}
|
||||
/**
|
||||
* Binary enter - callback for entering >>> operator
|
||||
* Binary enter - callback for entering {@literal >>>} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node
|
||||
@ -1254,7 +1254,7 @@ public class NodeOperatorVisitor extends NodeVisitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary leave - callback for leaving >>> operator
|
||||
* Binary leave - callback for leaving {@literal >>>} operator
|
||||
*
|
||||
* @param binaryNode the node
|
||||
* @return processed node, which will replace the original one, or the original node
|
||||
|
@ -221,7 +221,7 @@ public class DateParser {
|
||||
*
|
||||
* <p>English month names and selected time zone names as well as AM/PM markers are recognized
|
||||
* and handled properly. Additionally, numeric time zone offsets such as <tt>(+|-)hh:mm</tt> or
|
||||
* <tt></tt>(+|-)hhmm</tt> are recognized. If the string does not contain a time zone offset
|
||||
* <tt>(+|-)hhmm</tt> are recognized. If the string does not contain a time zone offset
|
||||
* the <tt>TIMEZONE</tt>field is left undefined, meaning the local time zone should be applied.</p>
|
||||
*
|
||||
* <p>English weekday names are recognized but ignored. All text in parentheses is ignored as well.
|
||||
|
@ -74,13 +74,16 @@ import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
|
||||
* delete x.p; // calls y.__delete__
|
||||
* for (i in x) { print(i); } // calls y.__getIds__
|
||||
* </pre>
|
||||
* <p>
|
||||
* JavaScript caller of adapter object is isolated from the fact that the property access/mutation/deletion are really
|
||||
* calls to JavaScript methods on adaptee.
|
||||
* </p><p>
|
||||
* </p>
|
||||
* <p>
|
||||
* JSAdapter constructor can optionally receive an "overrides" object. Properties of overrides object is copied to
|
||||
* JSAdapter instance. When user accessed property is one of these, then adaptee's methods like {@code __get__},
|
||||
* {@code __put__} etc. are not called for those. This can be used to make certain "preferred" properties that can be
|
||||
* accessed in the usual/faster way avoiding proxy mechanism. Example:
|
||||
* </p>
|
||||
* <pre>
|
||||
* var x = new JSAdapter({ foo: 444, bar: 6546 }) {
|
||||
* __get__: function(name) { return name; }
|
||||
|
@ -65,6 +65,7 @@ public final class NativeJava {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Given a name of a Java type, returns an object representing that type in Nashorn. The Java class of the objects
|
||||
* used to represent Java types in Nashorn is not {@link java.lang.Class} but rather {@link StaticClass}. They are
|
||||
* the objects that you can use with the {@code new} operator to create new instances of the class as well as to
|
||||
@ -75,7 +76,8 @@ public final class NativeJava {
|
||||
* different expression (e.g. {@code java.io.File}) as an argument in "new" and to address statics, and it is
|
||||
* distinct from the {@code Class} object (e.g. {@code java.io.File.class}). Below we cover in details the
|
||||
* properties of the type objects.
|
||||
* <h2>Constructing Java objects</h2>
|
||||
* </p>
|
||||
* <p><b>Constructing Java objects</b></p>
|
||||
* Examples:
|
||||
* <pre>
|
||||
* var arrayListType = Java.type("java.util.ArrayList")
|
||||
@ -104,19 +106,24 @@ public final class NativeJava {
|
||||
* var arctype = Java.type("java.awt.geom.Arc2D")
|
||||
* var ftype = arctype.Float
|
||||
* </pre>
|
||||
* <p>
|
||||
* You can access both static and non-static inner classes. If you want to create an instance of a non-static
|
||||
* inner class, remember to pass an instance of its outer class as the first argument to the constructor.
|
||||
* </p><p>
|
||||
* </p>
|
||||
* <p>
|
||||
* If the type is abstract, you can instantiate an anonymous subclass of it using an argument list that is
|
||||
* applicable to any of its public or protected constructors, but inserting a JavaScript object with functions
|
||||
* properties that provide JavaScript implementations of the abstract methods. If method names are overloaded, the
|
||||
* JavaScript function will provide implementation for all overloads. E.g.:
|
||||
* </p>
|
||||
* <pre>
|
||||
* var TimerTask = Java.type("java.util.TimerTask")
|
||||
* var task = new TimerTask({ run: function() { print("Hello World!") } })
|
||||
* </pre>
|
||||
* <p>
|
||||
* Nashorn supports a syntactic extension where a "new" expression followed by an argument is identical to
|
||||
* invoking the constructor and passing the argument to it, so you can write the above example also as:
|
||||
* </p>
|
||||
* <pre>
|
||||
* var task = new TimerTask {
|
||||
* run: function() {
|
||||
@ -124,30 +131,38 @@ public final class NativeJava {
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* which is very similar to Java anonymous inner class definition. On the other hand, if the type is an abstract
|
||||
* type with a single abstract method (commonly referred to as a "SAM type") or all abstract methods it has share
|
||||
* the same overloaded name), then instead of an object, you can just pass a function, so the above example can
|
||||
* become even more simplified to:
|
||||
* </p>
|
||||
* <pre>
|
||||
* var task = new TimerTask(function() { print("Hello World!") })
|
||||
* </pre>
|
||||
* <p>
|
||||
* Note that in every one of these cases if you are trying to instantiate an abstract class that has constructors
|
||||
* that take some arguments, you can invoke those simply by specifying the arguments after the initial
|
||||
* implementation object or function.
|
||||
* </p><p>The use of functions can be taken even further; if you are invoking a Java method that takes a SAM type,
|
||||
* </p>
|
||||
* <p>The use of functions can be taken even further; if you are invoking a Java method that takes a SAM type,
|
||||
* you can just pass in a function object, and Nashorn will know what you meant:
|
||||
* </p>
|
||||
* <pre>
|
||||
* var timer = new Java.type("java.util.Timer")
|
||||
* timer.schedule(function() { print("Hello World!") })
|
||||
* </pre>
|
||||
* <p>
|
||||
* Here, {@code Timer.schedule()} expects a {@code TimerTask} as its argument, so Nashorn creates an instance of a
|
||||
* {@code TimerTask} subclass and uses the passed function to implement its only abstract method, {@code run()}. In
|
||||
* this usage though, you can't use non-default constructors; the type must be either an interface, or must have a
|
||||
* protected or public no-arg constructor.
|
||||
* </p><p>
|
||||
* </p>
|
||||
* <p>
|
||||
* You can also subclass non-abstract classes; for that you will need to use the {@link #extend(Object, Object...)}
|
||||
* method.
|
||||
* <h2>Accessing static members</h2>
|
||||
* </p>
|
||||
* <p><b>Accessing static members</b></p>
|
||||
* Examples:
|
||||
* <pre>
|
||||
* var File = Java.type("java.io.File")
|
||||
@ -176,7 +191,7 @@ public final class NativeJava {
|
||||
* var File = Java.type("java.io.File")
|
||||
* print(File.class.static === File) // prints true
|
||||
* </pre>
|
||||
* <h2>{@code instanceof} operator</h2>
|
||||
* <p><b>{@code instanceof} operator</b></p>
|
||||
* The standard ECMAScript {@code instanceof} operator is extended to recognize Java objects and their type objects:
|
||||
* <pre>
|
||||
* var File = Java.type("java.io.File")
|
||||
@ -368,6 +383,7 @@ public final class NativeJava {
|
||||
* <li>If the Java method is overloaded (as in the above example {@code List.add()}), then your JavaScript adapter
|
||||
* must be prepared to deal with all overloads.</li>
|
||||
* <li>You can't invoke {@code super.*()} from adapters for now.</li>
|
||||
* </ul>
|
||||
* @param self not used
|
||||
* @param types the original types. The caller must pass at least one Java type object of class {@link StaticClass}
|
||||
* representing either a public interface or a non-final public class with at least one public or protected
|
||||
|
@ -30,7 +30,7 @@ package jdk.nashorn.internal.runtime;
|
||||
* As only the code generating package (i.e. Context) knows about
|
||||
* the ScriptLoader and it would be a security hazard otherwise
|
||||
* the Compiler is given an installation interface for its code.
|
||||
* <p>>
|
||||
* <p>
|
||||
* The compiler still retains most of the state around code emission
|
||||
* and management internally, so this is to avoid passing around any
|
||||
* logic that isn't directly related to installing a class
|
||||
|
@ -509,7 +509,7 @@ public final class Context {
|
||||
*
|
||||
* @param fullName full name of class, e.g. jdk.nashorn.internal.objects.JO$2P1 contains 2 fields and 1 parameter.
|
||||
*
|
||||
* @return the Class<?> for this structure
|
||||
* @return the {@code Class<?>} for this structure
|
||||
*
|
||||
* @throws ClassNotFoundException if structure class cannot be resolved
|
||||
*/
|
||||
@ -523,7 +523,7 @@ public final class Context {
|
||||
*
|
||||
* @param fullName full name of class to load
|
||||
*
|
||||
* @return the Class<?> for the name
|
||||
* @return the {@code Class<?>} for the name
|
||||
*
|
||||
* @throws ClassNotFoundException if class cannot be resolved
|
||||
*/
|
||||
|
@ -1463,7 +1463,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of <property, value> entries that make up this
|
||||
* Returns the set of {@literal <property, value>} entries that make up this
|
||||
* ScriptObject's properties
|
||||
* (java.util.Map-like method to help ScriptObjectMirror implementation)
|
||||
*
|
||||
@ -1524,7 +1524,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
* of their keys to their values
|
||||
* (java.util.Map-like method to help ScriptObjectMirror implementation)
|
||||
*
|
||||
* @param otherMap a <key,value> map of properties to add
|
||||
* @param otherMap a {@literal <key,value>} map of properties to add
|
||||
*/
|
||||
public void putAll(final Map<?, ?> otherMap) {
|
||||
final boolean strict = getContext()._strict;
|
||||
|
@ -815,7 +815,7 @@ public final class ScriptRuntime {
|
||||
}
|
||||
|
||||
/**
|
||||
* ECMA 11.8.1 - The less than operator (<) - generic implementation
|
||||
* ECMA 11.8.1 - The less than operator ({@literal <}) - generic implementation
|
||||
*
|
||||
* @param x first object to compare
|
||||
* @param y second object to compare
|
||||
@ -828,7 +828,7 @@ public final class ScriptRuntime {
|
||||
}
|
||||
|
||||
/**
|
||||
* ECMA 11.8.2 - The greater than operator (>) - generic implementation
|
||||
* ECMA 11.8.2 - The greater than operator ({@literal >}) - generic implementation
|
||||
*
|
||||
* @param x first object to compare
|
||||
* @param y second object to compare
|
||||
@ -841,7 +841,7 @@ public final class ScriptRuntime {
|
||||
}
|
||||
|
||||
/**
|
||||
* ECMA 11.8.3 - The less than or equal operator (<=) - generic implementation
|
||||
* ECMA 11.8.3 - The less than or equal operator ({@literal <=}) - generic implementation
|
||||
*
|
||||
* @param x first object to compare
|
||||
* @param y second object to compare
|
||||
@ -854,7 +854,7 @@ public final class ScriptRuntime {
|
||||
}
|
||||
|
||||
/**
|
||||
* ECMA 11.8.4 - The greater than or equal operator (>=) - generic implementation
|
||||
* ECMA 11.8.4 - The greater than or equal operator ({@literal >=}) - generic implementation
|
||||
*
|
||||
* @param x first object to compare
|
||||
* @param y second object to compare
|
||||
|
@ -87,7 +87,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime;
|
||||
import jdk.nashorn.internal.runtime.Undefined;
|
||||
|
||||
/**
|
||||
* A factory class that generates adapter classes. Adapter classes allow implementation of Java interfaces and
|
||||
* <p>A factory class that generates adapter classes. Adapter classes allow implementation of Java interfaces and
|
||||
* extending of Java classes from JavaScript. For every combination of a superclass to extend and interfaces to
|
||||
* implement (collectively: "original types"), exactly one adapter class is generated that extends the specified
|
||||
* superclass and implements the specified interfaces.
|
||||
|
@ -180,7 +180,7 @@ public class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor {
|
||||
/**
|
||||
* Returns the named operand in this descriptor's name. Equivalent to
|
||||
* {@code getNameToken(CallSiteDescriptor.NAME_OPERAND)}. E.g. for operation {@code "dyn:getProp:color"}, returns
|
||||
* {@code "color"}. For call sites without named operands (e.g. {@link "dyn:new"}) returns null.
|
||||
* {@code "color"}. For call sites without named operands (e.g. {@code "dyn:new"}) returns null.
|
||||
* @return the named operand in this descriptor's name.
|
||||
*/
|
||||
public String getOperand() {
|
||||
|
@ -200,7 +200,7 @@ public final class Options {
|
||||
|
||||
/**
|
||||
* Return an option given its resource key. If the key doesn't begin with
|
||||
* <resource>.option it will be completed using the resource from this
|
||||
* {@literal <resource>}.option it will be completed using the resource from this
|
||||
* instance
|
||||
*
|
||||
* @param key key for option
|
||||
|
@ -219,7 +219,7 @@ public class EncodingHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see [http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt]
|
||||
* @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a>
|
||||
*/
|
||||
public static boolean isCodeCType(int code, int ctype) {
|
||||
int type;
|
||||
|
Loading…
x
Reference in New Issue
Block a user