Skip to content
Permalink
Browse files
8253100: Fix "no comment" warnings in java.base/java.net
Reviewed-by: ryadav, chegar, naoto, alanb
  • Loading branch information
dfuch committed Mar 2, 2021
1 parent d185a6c commit 5f4bc0aca6c93ebae0fa0cf85c7c4955755cb539
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 34 deletions.
@@ -39,7 +39,14 @@ public class HttpRetryException extends IOException {
@java.io.Serial
private static final long serialVersionUID = -9186022286469111381L;

/**
* The response code.
*/
private int responseCode;

/**
* The URL to be redirected to.
*/
private String location;

/**
@@ -557,11 +557,15 @@ private int deriveNumericScope (String ifname) throws UnknownHostException {
}

/**
* @serialField ipaddress byte[]
* @serialField scope_id int
* @serialField scope_id_set boolean
* @serialField scope_ifname_set boolean
* @serialField ifname String
* @serialField ipaddress byte[] holds a 128-bit (16 bytes) IPv6 address
* @serialField scope_id int the address scope id. {@code 0} if undefined
* @serialField scope_id_set boolean {@code true} when the scope_id field
* contains a valid integer scope_id
* @serialField scope_ifname_set boolean {@code true} if the object is
* constructed with a scoped interface instead of a numeric
* scope id
* @serialField ifname String the name of the scoped network interface.
* {@code null} if undefined
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
@@ -578,9 +582,13 @@ private int deriveNumericScope (String ifname) throws UnknownHostException {
Inet6Address.class, "holder6");

/**
* restore the state of this object from stream
* including the scope information, only if the
* scoped interface name is valid on this system
* Restores the state of this object from the stream.
* This includes the scope information, but only if the
* scoped interface name is valid on this system.
*
* @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)
@@ -642,9 +650,12 @@ private void readObject(ObjectInputStream s)
}

/**
* default behavior is overridden in order to write the
* scope_ifname field as a String, rather than a NetworkInterface
* which is not serializable
* The default behavior of this method is overridden in order to
* write the scope_ifname field as a {@code String}, rather than a
* {@code NetworkInterface} which is not serializable.
*
* @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)
@@ -1712,6 +1712,9 @@ static InetAddressImpl loadImpl(String implName) {
return (InetAddressImpl) impl;
}

/**
* Initializes an empty InetAddress.
*/
@java.io.Serial
private void readObjectNoData () {
if (getClass().getClassLoader() != null) {
@@ -1724,6 +1727,13 @@ private void readObjectNoData () {
private static final long FIELDS_OFFSET
= UNSAFE.objectFieldOffset(InetAddress.class, "holder");

/**
* Restores the state of this object from the 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 (ObjectInputStream s) throws
IOException, ClassNotFoundException {
@@ -1744,9 +1754,10 @@ private void readObject (ObjectInputStream s) throws
/* needed because the serializable fields no longer exist */

/**
* @serialField hostName String
* @serialField address int
* @serialField family int
* @serialField hostName String the hostname for this address
* @serialField address int holds a 32-bit IPv4 address.
* @serialField family int specifies the address family type, for instance,
* {@code '1'} for IPv4 addresses, and {@code '2'} for IPv6 addresses.
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
@@ -1755,6 +1766,12 @@ private void readObject (ObjectInputStream s) throws
new ObjectStreamField("family", int.class),
};

/**
* Writes the state of this object to the stream.
*
* @param s the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
@java.io.Serial
private void writeObject (ObjectOutputStream s) throws
IOException {
@@ -264,16 +264,22 @@ public static InetSocketAddress createUnresolved(String host, int port) {
}

/**
* @serialField hostname String
* @serialField addr InetAddress
* @serialField port int
* @serialField hostname String the hostname of the Socket Address
* @serialField addr InetAddress the IP address of the Socket Address
* @serialField port int the port number of the Socket Address
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("hostname", String.class),
new ObjectStreamField("addr", InetAddress.class),
new ObjectStreamField("port", int.class)};

/**
* Writes the state of this object to the stream.
*
* @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
@@ -286,6 +292,13 @@ private void writeObject(ObjectOutputStream out)
out.writeFields();
}

/**
* Restores the state of this object from the stream.
*
* @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)
throws IOException, ClassNotFoundException
@@ -308,6 +321,10 @@ private void readObject(ObjectInputStream in)
UNSAFE.putReference(this, FIELDS_OFFSET, h);
}

/**
* Throws {@code InvalidObjectException}, always.
* @throws ObjectStreamException always
*/
@java.io.Serial
private void readObjectNoData()
throws ObjectStreamException
@@ -1189,9 +1189,12 @@ public PermissionCollection newPermissionCollection() {
}

/**
* WriteObject is called to save the state of the SocketPermission
* to a stream. The actions are serialized, and the superclass
* takes care of the name.
* {@code writeObject} is called to save the state of the
* {@code SocketPermission} to a stream. The actions are serialized,
* and the superclass takes care of the name.
*
* @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)
@@ -1205,8 +1208,12 @@ private synchronized void writeObject(java.io.ObjectOutputStream s)
}

/**
* readObject is called to restore the state of the SocketPermission from
* a stream.
* {@code readObject} is called to restore the state of the
* {@code SocketPermission} 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 synchronized void readObject(java.io.ObjectInputStream s)
@@ -1488,7 +1495,11 @@ public Enumeration<Permission> elements() {
};

/**
* Writes the state of this object to the stream.
* @serialData "permissions" field (a Vector containing the SocketPermissions).
*
* @param out the {@code ObjectOutputStream} to which data is written
* @throws IOException if an I/O error occurs
*/
/*
* Writes the contents of the perms field out as a Vector for
@@ -1506,8 +1517,13 @@ private void writeObject(ObjectOutputStream out) throws IOException {
out.writeFields();
}

/*
* Reads in a Vector of SocketPermissions and saves them in the perms field.
/**
* Reads in a {@code Vector} of {@code SocketPermission} 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)
@@ -1777,6 +1777,9 @@ public String toASCIIString() {
*
* @param os The object-output stream to which this object
* is to be written
*
* @throws IOException
* If an I/O error occurs
*/
@java.io.Serial
private void writeObject(ObjectOutputStream os)
@@ -1795,6 +1798,12 @@ private void writeObject(ObjectOutputStream os)
*
* @param is The object-input stream from which this object
* is being 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 is)
@@ -41,7 +41,15 @@
@java.io.Serial
private static final long serialVersionUID = 2137979680897488891L;

/**
* The input string.
*/
private String input;

/**
* The index at which the parse error occurred,
* or {@code -1} if the index is not known.
*/
private int index;

/**
@@ -1481,19 +1481,20 @@ static URLStreamHandler getURLStreamHandler(String protocol) {
}

/**
* @serialField protocol String
* @serialField protocol String the protocol to use (ftp, http, nntp, ... etc.)
*
* @serialField host String
* @serialField host String the host name to connect to
*
* @serialField port int
* @serialField port int the protocol port to connect to
*
* @serialField authority String
* @serialField authority String the authority part of this URL
*
* @serialField file String
* @serialField file String the specified file name on that host. {@code file} is
* defined as {@code path[?query]}
*
* @serialField ref String
* @serialField ref String the fragment part of this URL
*
* @serialField hashCode int
* @serialField hashCode int the hashCode of this URL
*
*/
@java.io.Serial
@@ -1515,6 +1516,9 @@ static URLStreamHandler getURLStreamHandler(String protocol) {
* the reader must ensure that calling getURLStreamHandler with
* the protocol variable returns a valid URLStreamHandler and
* throw an IOException if it does not.
*
* @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)
@@ -1527,6 +1531,10 @@ private synchronized void writeObject(java.io.ObjectOutputStream s)
* readObject is called to restore the state of the URL from the
* stream. It reads the components of the URL and finds the local
* stream handler.
*
* @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)
@@ -162,6 +162,9 @@ public final class URLPermission extends Permission {
private transient Authority authority;

// serialized field
/**
* The actions string
*/
private String actions;

/**
@@ -504,7 +507,11 @@ private String actions() {
}

/**
* restore the state of this object from stream
* Restores the state of this object from 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(ObjectInputStream s)
@@ -93,8 +93,9 @@ private Object readResolve() {
* <a href="{@docRoot}/serialized-form.html#java.net.UnixDomainSocketAddress.Ser">
* Ser</a> containing the path name of this instance.
*
* @return a {@link Ser}
* representing the path name of this instance
* @return a {@link Ser} representing the path name of this instance
*
* @throws ObjectStreamException if an error occurs
*/
@java.io.Serial
private Object writeReplace() throws ObjectStreamException {

0 comments on commit 5f4bc0a

Please sign in to comment.