< prev index next >

src/java.base/share/classes/java/io/ObjectOutputStream.java

Print this page
*** 1182,10 ***
--- 1182,12 ---
              }
  
              // remaining cases
              if (obj instanceof String) {
                  writeString((String) obj, unshared);
+             } else if (cl.isValue()) {
+                 throw new NotSerializableException(cl.getName());
              } else if (cl.isArray()) {
                  writeArray(obj, desc, unshared);
              } else if (obj instanceof Enum) {
                  writeEnum((Enum<?>) obj, desc, unshared);
              } else if (obj instanceof Serializable) {
< prev index next >