JDK 14 RFR of JDK-8231557: Suppress warnings on non-serializable instance fields in jdk.scripting.nashorn module

Joe Darcy joe.darcy at oracle.com
Thu Sep 26 22:45:05 UTC 2019


Hello,

Another part of an on-going cleanup of library serialization usage ahead 
of augmented javac -Xlint warnings (JDK-8160675), the non-serializable 
instance fields of serializable types in the jdk.scripting.nashorn 
module should have their serial warnings suppressed. The analogous issue 
in core libs is JDK-8231202.

Please review:

     JDK-8231557: Suppress warnings on non-serializable instance fields 
in jdk.scripting.nashorn module
     http://cr.openjdk.java.net/~darcy/8231557.0/

Patch below. I'll update copyright years before a push.

Thanks,

-Joe

--- 
old/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java 
2019-09-26 15:28:51.764610000 -0700
+++ 
new/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java 
2019-09-26 15:28:51.572514000 -0700
@@ -103,6 +103,7 @@
      public static final int IS_ACCESSOR_PROPERTY    = 1 << 12;

      /** Property key. */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Object key;

      /** Property flags. */
--- 
old/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java 
2019-09-26 15:28:52.300877999 -0700
+++ 
new/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java 
2019-09-26 15:28:52.108782000 -0700
@@ -118,11 +118,13 @@
       * Opaque object representing parser state at the end of the 
function. Used when reparsing outer function
       * to help with skipping parsing inner functions.
       */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Object endParserState;

      /** Code installer used for all further 
recompilation/specialization of this ScriptFunction */
      private transient CodeInstaller installer;

+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Map<Integer, RecompilableScriptFunctionData> 
nestedFunctions;

      /** Id to parent function if one exists */
@@ -135,8 +137,10 @@

      private transient DebugLogger log;

+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Map<String, Integer> externalScopeDepths;

+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Set<String> internalSymbols;

      private static final int GET_SET_PREFIX_LENGTH = "*et ".length();
--- 
old/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SharedPropertyMap.java 
2019-09-26 15:28:52.861157999 -0700
+++ 
new/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SharedPropertyMap.java 
2019-09-26 15:28:52.657056000 -0700
@@ -40,6 +40,7 @@
   */
  public final class SharedPropertyMap extends PropertyMap {

+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private SwitchPoint switchPoint;

      private static final long serialVersionUID = 2166297719721778876L;
--- 
old/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java 
2019-09-26 15:28:53.357406000 -0700
+++ 
new/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java 
2019-09-26 15:28:53.157306000 -0700
@@ -42,12 +42,15 @@
      private final String mainClassName;

      /** Map of class names to class bytes. */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Map<String, byte[]> classBytes;

      /** Constants array. */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Object[] constants;

      /** Function initializers */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
      private final Map<Integer, FunctionInitializer> initializers;

      private static final long serialVersionUID = 2958227232195298340L;



More information about the nashorn-dev mailing list