Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251203: Fix "no comment" warnings in java.base/java.lang and java/io
Reviewed-by: dfuchs, lancea, mchung, naoto
  • Loading branch information
Roger Riggs committed Aug 25, 2020
1 parent 5b18630 commit 2c3738563e8468eb82e9cd5063a2273fe3bd0482
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 28 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2020, 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
@@ -2231,6 +2231,9 @@ public String toString() {
* in case the path is reconstituted on a different host type.
*
* @serialData Default fields followed by separator character.
*
* @param s the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private synchronized void writeObject(java.io.ObjectOutputStream s)
@@ -2245,6 +2248,10 @@ private synchronized void writeObject(java.io.ObjectOutputStream s)
* The original separator character is read. If it is different
* than the separator character on this system, then the old separator
* is replaced by the local separator.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private synchronized void readObject(java.io.ObjectInputStream s)
@@ -1247,9 +1247,12 @@ public Enumeration<Permission> elements() {
/**
* @serialData "permissions" field (a Vector containing the FilePermissions).
*/
/*
/**
* Writes the contents of the perms field out as a Vector for
* serialization compatibility with earlier releases.
*
* @param out the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
@@ -1263,8 +1266,12 @@ private void writeObject(ObjectOutputStream out) throws IOException {
out.writeFields();
}

/*
/**
* Reads in a Vector of FilePermissions and saves them in the perms field.
*
* @param in the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private void readObject(ObjectInputStream in)
@@ -93,6 +93,9 @@ public class ObjectStreamClass implements Serializable {

@java.io.Serial
private static final long serialVersionUID = -6120832682080437368L;
/**
* {@code ObjectStreamClass} has no fields for default serialization.
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields =
NO_FIELDS;
@@ -2538,7 +2541,9 @@ public boolean equals(Object obj) {
}
}

// a LRA cache of record deserialization constructors
/**
* A LRA cache of record deserialization constructors.
*/
@SuppressWarnings("serial")
private static final class DeserializationConstructorsCache
extends ConcurrentHashMap<DeserializationConstructorsCache.Key, MethodHandle> {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@@ -76,6 +76,9 @@ public IOException getCause() {
/**
* Called to read the object from a stream.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
* @throws InvalidObjectException
* if the object is invalid or has a cause that is not
* an {@code IOException}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -585,7 +585,12 @@ public AbstractStringBuilder append(String str) {
return this;
}

// Documentation in subclasses because of synchro difference
/**
* Appends the specified {@code StringBuffer} to this sequence.
*
* @param sb the {@code StringBuffer} to append.
* @return a reference to this object.
*/
public AbstractStringBuilder append(StringBuffer sb) {
return this.append((AbstractStringBuilder)sb);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2020, 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
@@ -110,21 +110,25 @@ public Throwable getException() {
/**
* Serializable fields for ClassNotFoundException.
*
* @serialField ex Throwable
* @serialField ex Throwable the {@code Throwable}
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("ex", Throwable.class)
};

/*
/**
* Reconstitutes the ClassNotFoundException instance from a stream
* and initialize the cause properly when deserializing from an older
* version.
*
* The getException and getCause method returns the private "ex" field
* in the older implementation and ClassNotFoundException::cause
* was set to null.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
@@ -135,9 +139,12 @@ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundEx
}
}

/*
/**
* To maintain compatibility with older implementation, write a serial
* "ex" field with the cause as the value.
*
* @param out the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@@ -108,21 +108,25 @@ public Throwable getException() {
/**
* Serializable fields for ExceptionInInitializerError.
*
* @serialField exception Throwable
* @serialField exception Throwable the exception
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("exception", Throwable.class)
};

/*
/**
* Reconstitutes the ExceptionInInitializerError instance from a stream
* and initialize the cause properly when deserializing from an older
* version.
*
* The getException and getCause method returns the private "exception"
* field in the older implementation and ExceptionInInitializerError::cause
* was set to null.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
@@ -133,9 +137,12 @@ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundEx
}
}

/*
/**
* To maintain compatibility with older implementation, write a serial
* "exception" field with the cause as the value.
*
* @param out the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
@@ -60,13 +60,37 @@ public final class StackTraceElement implements java.io.Serializable {
private transient Class<?> declaringClassObject;

// Normally initialized by VM
/**
* The name of the class loader.
*/
private String classLoaderName;
/**
* The module name.
*/
private String moduleName;
/**
* The module version.
*/
private String moduleVersion;
/**
* The declaring class.
*/
private String declaringClass;
/**
* The method name.
*/
private String methodName;
/**
* The source file name.
*/
private String fileName;
/**
* The source line number.
*/
private int lineNumber;
/**
* Control to show full or partial module, package, and class names.
*/
private byte format = 0; // Default to show all

/**
@@ -1236,6 +1236,10 @@ public int compareTo(String anotherString) {
*/
public static final Comparator<String> CASE_INSENSITIVE_ORDER
= new CaseInsensitiveComparator();

/**
* CaseInsensitiveComparator for Strings.
*/
private static class CaseInsensitiveComparator
implements Comparator<String>, java.io.Serializable {
// use serialVersionUID from JDK 1.2.2 for interoperability
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2020, 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
@@ -25,6 +25,7 @@

package java.lang;

import java.io.IOException;
import java.util.Arrays;
import jdk.internal.HotSpotIntrinsicCandidate;

@@ -733,8 +734,11 @@ public synchronized String toString() {
};

/**
* readObject is called to restore the state of the StringBuffer from
* The {@code writeObject} method is called to write the state of the {@code StringBuffer} to
* a stream.
*
* @param s the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private synchronized void writeObject(java.io.ObjectOutputStream s)
@@ -753,8 +757,12 @@ private synchronized void writeObject(java.io.ObjectOutputStream s)
}

/**
* readObject is called to restore the state of the StringBuffer from
* The {@code readObject} method is called to restore the state of the {@code StringBuffer} from
* a stream.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream s)
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -27,6 +27,8 @@

import jdk.internal.HotSpotIntrinsicCandidate;

import java.io.IOException;

/**
* A mutable sequence of characters. This class provides an API compatible
* with {@code StringBuffer}, but with no guarantee of synchronization.
@@ -458,6 +460,9 @@ public String toString() {
* {@code char} array may be greater than the number of
* characters currently stored in the string builder, in which
* case extra characters are ignored.
*
* @param s the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private void writeObject(java.io.ObjectOutputStream s)
@@ -476,10 +481,14 @@ private void writeObject(java.io.ObjectOutputStream s)
/**
* readObject is called to restore the state of the StringBuffer from
* a stream.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
throws IOException, ClassNotFoundException {
s.defaultReadObject();
count = s.readInt();
char[] val = (char[]) s.readObject();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2020, 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
@@ -902,6 +902,10 @@ public void setStackTrace(StackTraceElement[] stackTrace) {
* Note that there are no constraints on the value the {@code
* cause} field can hold; both {@code null} and {@code this} are
* valid values for the field.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
private void readObject(ObjectInputStream s)
@@ -991,6 +995,9 @@ private int validateSuppressedExceptionsList(List<Throwable> deserSuppressedExce
* A {@code null} stack trace field is represented in the serial
* form as a one-element array whose element is equal to {@code
* new StackTraceElement("", "", null, Integer.MIN_VALUE)}.
*
* @param s the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private synchronized void writeObject(ObjectOutputStream s)
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -47,6 +47,9 @@ public class TypeNotPresentException extends RuntimeException {
@java.io.Serial
private static final long serialVersionUID = -5101214195716534496L;

/**
* The type name.
*/
private String typeName;

/**

0 comments on commit 2c37385

Please sign in to comment.