test/jdk/java/io/Serializable/writeObjectMemory/WriteObjectMemory.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
--- a/test/jdk/java/io/Serializable/writeObjectMemory/WriteObjectMemory.java	Fri Oct 11 09:43:41 2019 -0700
+++ b/test/jdk/java/io/Serializable/writeObjectMemory/WriteObjectMemory.java	Fri Oct 11 13:11:56 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,9 @@
 import java.util.Iterator;
 
 class A implements Serializable {
-    static HashSet writeObjectExtent = new HashSet();
+    private static final long serialVersionUID = 1L;
+
+    static HashSet<A>writeObjectExtent = new HashSet<>();
 
     private void writeObject(ObjectOutputStream out) throws IOException {
         if (writeObjectExtent.contains(this)) {
@@ -53,7 +55,7 @@
 
 public class WriteObjectMemory {
     public static void main(String args[])
-        throws IOException, ClassNotFoundException
+        throws IOException
     {
         ObjectOutputStream out =
             new ObjectOutputStream(new ByteArrayOutputStream(3000));
@@ -65,7 +67,7 @@
         // allow writeObject to be called on any objects that
         // have already been serialized. These objects should be
         // written out by reference.
-        Iterator iter = A.writeObjectExtent.iterator();
+        Iterator<A> iter = A.writeObjectExtent.iterator();
         while (iter.hasNext()) {
             out.writeObject(iter.next());
         }