8059843: Make AST serializable

Reviewed-by: hannesw, lagergren
This commit is contained in:
Attila Szegedi 2014-10-17 14:24:26 +02:00
parent 839cec40e9
commit 36ddb21187
53 changed files with 156 additions and 25 deletions

View File

@ -25,24 +25,29 @@
package jdk.nashorn.internal.codegen;
import java.io.Serializable;
import java.util.Set;
import java.util.TreeSet;
/**
* Used to track split class compilation.
*/
public final class CompileUnit implements Comparable<CompileUnit> {
* Used to track split class compilation. Note that instances of the class are serializable, but all fields are
* transient, making the serialized version of the class only useful for tracking the referential topology of other
* AST nodes referencing the same or different compile units.
*/
public final class CompileUnit implements Comparable<CompileUnit>, Serializable {
private static final long serialVersionUID = 1L;
/** Current class name */
private final String className;
private transient final String className;
/** Current class generator */
private ClassEmitter classEmitter;
private transient ClassEmitter classEmitter;
private long weight;
private transient long weight;
private Class<?> clazz;
private transient Class<?> clazz;
private boolean isUsed;
private transient boolean isUsed;
private static int emittedUnitCount;

View File

@ -24,6 +24,7 @@
*/
package jdk.nashorn.internal.codegen;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
@ -39,7 +40,9 @@ import jdk.nashorn.internal.codegen.types.Type;
*
* see -Dnashorn.codegen.debug, --log=codegen
*/
public final class Label {
public final class Label implements Serializable {
private static final long serialVersionUID = 1L;
//byte code generation evaluation type stack for consistency check
//and correct opcode selection. one per label as a label may be a
//join point
@ -491,7 +494,7 @@ public final class Label {
private final String name;
/** Type stack at this label */
private Label.Stack stack;
private transient Label.Stack stack;
/** ASM representation of this label */
private jdk.internal.org.objectweb.asm.Label label;
@ -500,9 +503,9 @@ public final class Label {
private final int id;
/** Is this label reachable (anything ever jumped to it)? */
private boolean reachable;
private transient boolean reachable;
private boolean breakTarget;
private transient boolean breakTarget;
/**
* Constructor

View File

@ -37,6 +37,7 @@ import jdk.internal.org.objectweb.asm.MethodVisitor;
* This is an array type, i.e. OBJECT_ARRAY, NUMBER_ARRAY.
*/
public class ArrayType extends ObjectType implements BytecodeArrayOps {
private static final long serialVersionUID = 1L;
/**
* Constructor

View File

@ -29,6 +29,7 @@ package jdk.nashorn.internal.codegen.types;
* This class represents a numeric type that can be used for bit operations.
*/
public abstract class BitwiseType extends NumericType implements BytecodeBitwiseOps {
private static final long serialVersionUID = 1L;
/**
* Constructor

View File

@ -69,6 +69,7 @@ import jdk.nashorn.internal.codegen.CompilerConstants;
* The boolean type class
*/
public final class BooleanType extends Type {
private static final long serialVersionUID = 1L;
private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Boolean.class, "valueOf", Boolean.class, boolean.class);
private static final CompilerConstants.Call TO_STRING = staticCallNoLookup(Boolean.class, "toString", String.class, boolean.class);

View File

@ -60,6 +60,7 @@ import jdk.nashorn.internal.codegen.CompilerConstants;
* Type class: INT
*/
class IntType extends BitwiseType {
private static final long serialVersionUID = 1L;
private static final CompilerConstants.Call TO_STRING = staticCallNoLookup(Integer.class, "toString", String.class, int.class);
private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Integer.class, "valueOf", Integer.class, int.class);

View File

@ -54,6 +54,7 @@ import jdk.nashorn.internal.runtime.JSType;
* Type class: LONG
*/
class LongType extends BitwiseType {
private static final long serialVersionUID = 1L;
private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Long.class, "valueOf", Long.class, long.class);

View File

@ -46,6 +46,7 @@ import jdk.nashorn.internal.codegen.CompilerConstants;
import jdk.nashorn.internal.runtime.JSType;
class NumberType extends NumericType {
private static final long serialVersionUID = 1L;
private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Double.class, "valueOf", Double.class, double.class);

View File

@ -29,6 +29,8 @@ package jdk.nashorn.internal.codegen.types;
* This is a numeric type, i.e. NUMBER, LONG, INT, INT32.
*/
public abstract class NumericType extends Type implements BytecodeNumericOps {
private static final long serialVersionUID = 1L;
/**
* Constructor
*

View File

@ -47,6 +47,7 @@ import jdk.nashorn.internal.runtime.Undefined;
* contain a class that is a more specialized object
*/
class ObjectType extends Type {
private static final long serialVersionUID = 1L;
protected ObjectType() {
this(Object.class);

View File

@ -47,9 +47,11 @@ import static jdk.internal.org.objectweb.asm.Opcodes.T_DOUBLE;
import static jdk.internal.org.objectweb.asm.Opcodes.T_INT;
import static jdk.internal.org.objectweb.asm.Opcodes.T_LONG;
import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
import java.lang.invoke.CallSite;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@ -88,19 +90,20 @@ import jdk.nashorn.internal.runtime.linker.Bootstrap;
* INTs rather than OBJECTs
*/
public abstract class Type implements Comparable<Type>, BytecodeOps {
public abstract class Type implements Comparable<Type>, BytecodeOps, Serializable {
private static final long serialVersionUID = 1L;
/** Human readable name for type */
private final String name;
private transient final String name;
/** Descriptor for type */
private final String descriptor;
private transient final String descriptor;
/** The "weight" of the type. Used for picking widest/least specific common type */
private final int weight;
private transient final int weight;
/** How many bytecode slots does this type occupy */
private final int slots;
private transient final int slots;
/** The class for this type */
private final Class<?> clazz;
@ -113,7 +116,7 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
Collections.synchronizedMap(new WeakHashMap<Class<?>, jdk.internal.org.objectweb.asm.Type>());
/** Internal ASM type for this Type - computed once at construction */
private final jdk.internal.org.objectweb.asm.Type internalType;
private transient final jdk.internal.org.objectweb.asm.Type internalType;
/** Weights are used to decide which types are "wider" than other types */
protected static final int MIN_WEIGHT = -1;
@ -934,6 +937,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
* This is the singleton for integer arrays
*/
public static final ArrayType INT_ARRAY = new ArrayType(int[].class) {
private static final long serialVersionUID = 1L;
@Override
public void astore(final MethodVisitor method) {
method.visitInsn(IASTORE);
@ -961,6 +966,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
* This is the singleton for long arrays
*/
public static final ArrayType LONG_ARRAY = new ArrayType(long[].class) {
private static final long serialVersionUID = 1L;
@Override
public void astore(final MethodVisitor method) {
method.visitInsn(LASTORE);
@ -988,6 +995,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
* This is the singleton for numeric arrays
*/
public static final ArrayType NUMBER_ARRAY = new ArrayType(double[].class) {
private static final long serialVersionUID = 1L;
@Override
public void astore(final MethodVisitor method) {
method.visitInsn(DASTORE);
@ -1022,6 +1031,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
/** This type, always an object type, just a toString override */
public static final Type THIS = new ObjectType() {
private static final long serialVersionUID = 1L;
@Override
public String toString() {
return "this";
@ -1030,6 +1041,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
/** Scope type, always an object type, just a toString override */
public static final Type SCOPE = new ObjectType() {
private static final long serialVersionUID = 1L;
@Override
public String toString() {
return "scope";
@ -1041,6 +1054,7 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
}
private abstract static class ValueLessType extends Type {
private static final long serialVersionUID = 1L;
ValueLessType(final String name) {
super(name, Unknown.class, MIN_WEIGHT, 1);
@ -1092,6 +1106,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
* inference. It has the minimum type width
*/
public static final Type UNKNOWN = new ValueLessType("<unknown>") {
private static final long serialVersionUID = 1L;
@Override
public String getDescriptor() {
return "<unknown>";
@ -1108,6 +1124,7 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
* inference. It has the minimum type width
*/
public static final Type SLOT_2 = new ValueLessType("<slot_2>") {
private static final long serialVersionUID = 1L;
@Override
public String getDescriptor() {
@ -1124,4 +1141,8 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
cache.put(type.getTypeClass(), type);
return type;
}
protected final Object readResolve() {
return Type.typeFor(clazz);
}
}

View File

@ -34,6 +34,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class AccessNode extends BaseNode {
private static final long serialVersionUID = 1L;
/** Property name. */
private final String property;

View File

@ -39,6 +39,7 @@ import jdk.nashorn.internal.ir.annotations.Immutable;
*/
@Immutable
public abstract class BaseNode extends Expression implements FunctionCall, Optimistic {
private static final long serialVersionUID = 1L;
/** Base Node. */
protected final Expression base;

View File

@ -43,6 +43,8 @@ import jdk.nashorn.internal.parser.TokenType;
*/
@Immutable
public final class BinaryNode extends Expression implements Assignment<Expression>, Optimistic {
private static final long serialVersionUID = 1L;
// Placeholder for "undecided optimistic ADD type". Unfortunately, we can't decide the type of ADD during optimistic
// type calculation as it can have local variables as its operands that will decide its ultimate type.
private static final Type OPTIMISTIC_UNDECIDED_TYPE = Type.typeFor(new Object(){/*empty*/}.getClass());
@ -56,8 +58,8 @@ public final class BinaryNode extends Expression implements Assignment<Expressio
private final Type type;
private Type cachedType;
private Object cachedTypeFunction;
private transient Type cachedType;
private transient Object cachedTypeFunction;
@Ignore
private static final Set<TokenType> CAN_OVERFLOW =

View File

@ -42,6 +42,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public class Block extends Node implements BreakableNode, Terminal, Flags<Block> {
private static final long serialVersionUID = 1L;
/** List of statements */
protected final List<Statement> statements;

View File

@ -32,6 +32,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
* Represents a block used as a statement.
*/
public class BlockStatement extends Statement {
private static final long serialVersionUID = 1L;
/** Block to execute. */
private final Block block;

View File

@ -34,6 +34,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class BreakNode extends JumpStatement {
private static final long serialVersionUID = 1L;
/**
* Constructor

View File

@ -32,6 +32,7 @@ import jdk.nashorn.internal.ir.annotations.Immutable;
@Immutable
abstract class BreakableStatement extends LexicalContextStatement implements BreakableNode {
private static final long serialVersionUID = 1L;
/** break label. */
protected final Label breakLabel;

View File

@ -27,6 +27,7 @@ package jdk.nashorn.internal.ir;
import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
@ -40,6 +41,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class CallNode extends LexicalContextExpression implements Optimistic {
private static final long serialVersionUID = 1L;
/** Function identifier or function body. */
private final Expression function;
@ -64,7 +66,8 @@ public final class CallNode extends LexicalContextExpression implements Optimist
/**
* Arguments to be passed to builtin {@code eval} function
*/
public static class EvalArgs {
public static class EvalArgs implements Serializable {
private static final long serialVersionUID = 1L;
private final List<Expression> args;
/** location string for the eval call */

View File

@ -37,6 +37,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class CaseNode extends Node implements JoinPredecessor, Labels, Terminal {
private static final long serialVersionUID = 1L;
/** Test expression. */
private final Expression test;

View File

@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class CatchNode extends Statement {
private static final long serialVersionUID = 1L;
/** Exception identifier. */
private final IdentNode exception;

View File

@ -34,6 +34,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public class ContinueNode extends JumpStatement {
private static final long serialVersionUID = 1L;
/**
* Constructor
*
@ -80,4 +82,3 @@ public class ContinueNode extends JumpStatement {
return ((LoopNode)target).getContinueLabel();
}
}

View File

@ -33,6 +33,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class EmptyNode extends Statement {
private static final long serialVersionUID = 1L;
/**
* Constructor

View File

@ -35,6 +35,8 @@ import jdk.nashorn.internal.runtime.UnwarrantedOptimismException;
*
*/
public abstract class Expression extends Node {
private static final long serialVersionUID = 1L;
static final String OPT_IDENTIFIER = "%";
private static final Function<Symbol, Type> UNKNOWN_LOCALS = new Function<Symbol, Type>() {

View File

@ -35,6 +35,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class ExpressionStatement extends Statement {
private static final long serialVersionUID = 1L;
/** Expression to execute. */
private final Expression expression;

View File

@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class ForNode extends LoopNode {
private static final long serialVersionUID = 1L;
/** Initialize expression for an ordinary for statement, or the LHS expression receiving iterated-over values in a
* for-in statement. */
private final Expression init;

View File

@ -57,6 +57,8 @@ import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
*/
@Immutable
public final class FunctionNode extends LexicalContextExpression implements Flags<FunctionNode>, CompileUnitHolder {
private static final long serialVersionUID = 1L;
/** Type used for all FunctionNodes */
public static final Type FUNCTION_TYPE = Type.typeFor(ScriptFunction.class);

View File

@ -42,6 +42,8 @@ import jdk.nashorn.internal.parser.TokenType;
*/
@Immutable
public final class IdentNode extends Expression implements PropertyKey, FunctionCall, Optimistic, JoinPredecessor {
private static final long serialVersionUID = 1L;
private static final int PROPERTY_NAME = 1 << 0;
private static final int INITIALIZED_HERE = 1 << 1;
private static final int FUNCTION = 1 << 2;

View File

@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class IfNode extends Statement implements JoinPredecessor {
private static final long serialVersionUID = 1L;
/** Test expression. */
private final Expression test;

View File

@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class IndexNode extends BaseNode {
private static final long serialVersionUID = 1L;
/** Property index. */
private final Expression index;

View File

@ -33,6 +33,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
* A wrapper for an expression that is in a position to be a join predecessor.
*/
public class JoinPredecessorExpression extends Expression implements JoinPredecessor {
private static final long serialVersionUID = 1L;
private final Expression expression;
private final LocalVariableConversion conversion;

View File

@ -31,6 +31,7 @@ import jdk.nashorn.internal.codegen.Label;
* Common base class for jump statements (e.g. {@code break} and {@code continue}).
*/
public abstract class JumpStatement extends Statement implements JoinPredecessor {
private static final long serialVersionUID = 1L;
private final String labelName;
private final LocalVariableConversion conversion;

View File

@ -35,6 +35,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class LabelNode extends LexicalContextStatement implements JoinPredecessor {
private static final long serialVersionUID = 1L;
/** Label ident. */
private final String labelName;

View File

@ -28,6 +28,7 @@ package jdk.nashorn.internal.ir;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
abstract class LexicalContextExpression extends Expression implements LexicalContextNode {
private static final long serialVersionUID = 1L;
LexicalContextExpression(final LexicalContextExpression expr) {
super(expr);

View File

@ -28,6 +28,8 @@ package jdk.nashorn.internal.ir;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
abstract class LexicalContextStatement extends Statement implements LexicalContextNode {
private static final long serialVersionUID = 1L;
/**
* Constructor
*

View File

@ -25,6 +25,7 @@
package jdk.nashorn.internal.ir;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -49,6 +50,8 @@ import jdk.nashorn.internal.runtime.Undefined;
*/
@Immutable
public abstract class LiteralNode<T> extends Expression implements PropertyKey {
private static final long serialVersionUID = 1L;
/** Literal value */
protected final T value;
@ -270,6 +273,8 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
* @param <T> the literal type
*/
public static class PrimitiveLiteralNode<T> extends LiteralNode<T> {
private static final long serialVersionUID = 1L;
private PrimitiveLiteralNode(final long token, final int finish, final T value) {
super(token, finish, value);
}
@ -304,6 +309,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
@Immutable
private static final class BooleanLiteralNode extends PrimitiveLiteralNode<Boolean> {
private static final long serialVersionUID = 1L;
private BooleanLiteralNode(final long token, final int finish, final boolean value) {
super(Token.recast(token, value ? TokenType.TRUE : TokenType.FALSE), finish, value);
@ -356,6 +362,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
@Immutable
private static final class NumberLiteralNode extends PrimitiveLiteralNode<Number> {
private static final long serialVersionUID = 1L;
private final Type type = numberGetType(value);
@ -418,6 +425,8 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
}
private static class UndefinedLiteralNode extends PrimitiveLiteralNode<Undefined> {
private static final long serialVersionUID = 1L;
private UndefinedLiteralNode(final long token, final int finish) {
super(Token.recast(token, TokenType.OBJECT), finish, ScriptRuntime.UNDEFINED);
}
@ -454,6 +463,8 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
@Immutable
private static class StringLiteralNode extends PrimitiveLiteralNode<String> {
private static final long serialVersionUID = 1L;
private StringLiteralNode(final long token, final int finish, final String value) {
super(Token.recast(token, TokenType.STRING), finish, value);
}
@ -497,6 +508,8 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
@Immutable
private static class LexerTokenLiteralNode extends LiteralNode<LexerToken> {
private static final long serialVersionUID = 1L;
private LexerTokenLiteralNode(final long token, final int finish, final LexerToken value) {
super(Token.recast(token, TokenType.STRING), finish, value); //TODO is string the correct token type here?
}
@ -560,6 +573,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
}
private static final class NullLiteralNode extends PrimitiveLiteralNode<Object> {
private static final long serialVersionUID = 1L;
private NullLiteralNode(final long token, final int finish) {
super(Token.recast(token, TokenType.OBJECT), finish, null);
@ -590,6 +604,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
*/
@Immutable
public static final class ArrayLiteralNode extends LiteralNode<Expression[]> implements LexicalContextNode {
private static final long serialVersionUID = 1L;
/** Array element type. */
private final Type elementType;
@ -607,7 +622,9 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
* An ArrayUnit is a range in an ArrayLiteral. ArrayLiterals can
* be split if they are too large, for bytecode generation reasons
*/
public static final class ArrayUnit implements CompileUnitHolder {
public static final class ArrayUnit implements CompileUnitHolder, Serializable {
private static final long serialVersionUID = 1L;
/** Compile unit associated with the postsets range. */
private final CompileUnit compileUnit;

View File

@ -34,6 +34,8 @@ import jdk.nashorn.internal.codegen.Label;
* A loop node, for example a while node, do while node or for node
*/
public abstract class LoopNode extends BreakableStatement {
private static final long serialVersionUID = 1L;
/** loop continue label. */
protected final Label continueLabel;

View File

@ -25,6 +25,7 @@
package jdk.nashorn.internal.ir;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@ -34,7 +35,9 @@ import jdk.nashorn.internal.parser.TokenType;
/**
* Nodes are used to compose Abstract Syntax Trees.
*/
public abstract class Node implements Cloneable {
public abstract class Node implements Cloneable, Serializable {
private static final long serialVersionUID = 1L;
/** Start of source range. */
protected final int start;

View File

@ -37,6 +37,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class ObjectNode extends Expression {
private static final long serialVersionUID = 1L;
/** Literal elements. */
private final List<PropertyNode> elements;

View File

@ -33,6 +33,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class PropertyNode extends Node {
private static final long serialVersionUID = 1L;
/** Property key. */
private final PropertyKey key;

View File

@ -36,6 +36,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public class ReturnNode extends Statement {
private static final long serialVersionUID = 1L;
/** Optional expression. */
private final Expression expression;

View File

@ -42,6 +42,7 @@ import jdk.nashorn.internal.parser.TokenType;
*/
@Immutable
public class RuntimeNode extends Expression implements Optimistic {
private static final long serialVersionUID = 1L;
/**
* Request enum used for meta-information about the runtime request

View File

@ -40,6 +40,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public class SplitNode extends LexicalContextStatement implements Labels, CompileUnitHolder {
private static final long serialVersionUID = 1L;
/** Split node method name. */
private final String name;

View File

@ -31,6 +31,7 @@ package jdk.nashorn.internal.ir;
* location information is the Statement
*/
public abstract class Statement extends Node implements Terminal {
private static final long serialVersionUID = 1L;
private final int lineNumber;

View File

@ -37,6 +37,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class SwitchNode extends BreakableStatement {
private static final long serialVersionUID = 1L;
/** Switch expression. */
private final Expression expression;

View File

@ -37,6 +37,8 @@ import jdk.nashorn.internal.parser.TokenType;
*/
@Immutable
public final class TernaryNode extends Expression {
private static final long serialVersionUID = 1L;
private final Expression test;
private final JoinPredecessorExpression trueExpr;
private final JoinPredecessorExpression falseExpr;

View File

@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class ThrowNode extends Statement implements JoinPredecessor {
private static final long serialVersionUID = 1L;
/** Exception expression. */
private final Expression expression;

View File

@ -36,6 +36,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class TryNode extends Statement implements JoinPredecessor {
private static final long serialVersionUID = 1L;
/** Try statements. */
private final Block body;

View File

@ -46,6 +46,8 @@ import jdk.nashorn.internal.parser.TokenType;
*/
@Immutable
public final class UnaryNode extends Expression implements Assignment<Expression>, Optimistic {
private static final long serialVersionUID = 1L;
/** Right hand side argument. */
private final Expression expression;

View File

@ -34,6 +34,8 @@ import jdk.nashorn.internal.parser.Token;
*/
@Immutable
public final class VarNode extends Statement implements Assignment<IdentNode> {
private static final long serialVersionUID = 1L;
/** Var name. */
private final IdentNode name;

View File

@ -34,6 +34,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class WhileNode extends LoopNode {
private static final long serialVersionUID = 1L;
/** is this a do while node ? */
private final boolean isDoWhile;

View File

@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class WithNode extends LexicalContextStatement {
private static final long serialVersionUID = 1L;
/** This expression. */
private final Expression expression;

View File

@ -46,6 +46,7 @@ import static jdk.nashorn.internal.parser.TokenType.RPAREN;
import static jdk.nashorn.internal.parser.TokenType.STRING;
import static jdk.nashorn.internal.parser.TokenType.XML;
import java.io.Serializable;
import jdk.nashorn.internal.runtime.ECMAErrors;
import jdk.nashorn.internal.runtime.ErrorManager;
import jdk.nashorn.internal.runtime.JSErrorType;
@ -1717,7 +1718,9 @@ public class Lexer extends Scanner {
* Helper class for Lexer tokens, e.g XML or RegExp tokens.
* This is the abstract superclass
*/
public static abstract class LexerToken {
public static abstract class LexerToken implements Serializable {
private static final long serialVersionUID = 1L;
private final String expression;
/**
@ -1741,6 +1744,8 @@ public class Lexer extends Scanner {
* Temporary container for regular expressions.
*/
public static class RegexToken extends LexerToken {
private static final long serialVersionUID = 1L;
/** Options. */
private final String options;
@ -1773,6 +1778,7 @@ public class Lexer extends Scanner {
* Temporary container for XML expression.
*/
public static class XMLToken extends LexerToken {
private static final long serialVersionUID = 1L;
/**
* Constructor.