8058304: Non-serializable fields in serializable classes
Reviewed-by: lagergren, sundar
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Fri Sep 12 11:00:51 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Fri Sep 12 15:01:48 2014 +0200
@@ -54,6 +54,7 @@
import static jdk.nashorn.internal.parser.TokenType.TERNARY;
import static jdk.nashorn.internal.parser.TokenType.WHILE;
+import java.io.Serializable;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
@@ -2977,11 +2978,13 @@
* Encapsulates part of the state of the parser, enough to reconstruct the state of both parser and lexer
* for resuming parsing after skipping a function body.
*/
- private static class ParserState {
+ private static class ParserState implements Serializable {
private final int position;
private final int line;
private final int linePosition;
+ private static final long serialVersionUID = -2382565130754093694L;
+
ParserState(final int position, final int line, final int linePosition) {
this.position = position;
this.line = line;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java Fri Sep 12 11:00:51 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java Fri Sep 12 15:01:48 2014 +0200
@@ -119,7 +119,7 @@
* produce different boun method handles wrapping the same access mechanism
* depending on callsite
*/
- private MethodHandle[] GETTER_CACHE = new MethodHandle[NOOF_TYPES];
+ private transient MethodHandle[] GETTER_CACHE = new MethodHandle[NOOF_TYPES];
/**
* Create a new accessor property. Factory method used by nasgen generated code.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java Fri Sep 12 11:00:51 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java Fri Sep 12 15:01:48 2014 +0200
@@ -101,7 +101,7 @@
private final int slot;
/** SwitchPoint that is invalidated when property is changed, optional */
- protected SwitchPoint changeCallback;
+ protected transient SwitchPoint changeCallback;
private static final long serialVersionUID = 2099814273074501176L;