8253100: Fix "no comment" warnings in java.base/java.net

Reviewed-by: ryadav, chegar, naoto, alanb
This commit is contained in:
Daniel Fuchs 2021-03-02 12:54:54 +00:00
parent d185a6c53e
commit 5f4bc0aca6
10 changed files with 135 additions and 34 deletions

View file

@ -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;
/**

View file

@ -557,11 +557,15 @@ class Inet6Address extends InetAddress {
}
/**
* @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 @@ class Inet6Address extends InetAddress {
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 @@ class Inet6Address extends InetAddress {
}
/**
* 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)

View file

@ -1712,6 +1712,9 @@ public class InetAddress implements java.io.Serializable {
return (InetAddressImpl) impl;
}
/**
* Initializes an empty InetAddress.
*/
@java.io.Serial
private void readObjectNoData () {
if (getClass().getClassLoader() != null) {
@ -1724,6 +1727,13 @@ public class InetAddress implements java.io.Serializable {
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 @@ public class InetAddress implements java.io.Serializable {
/* 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 @@ public class InetAddress implements java.io.Serializable {
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 {

View file

@ -264,9 +264,9 @@ public class InetSocketAddress
}
/**
* @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 = {
@ -274,6 +274,12 @@ public class InetSocketAddress
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 @@ public class InetSocketAddress
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 @@ public class InetSocketAddress
UNSAFE.putReference(this, FIELDS_OFFSET, h);
}
/**
* Throws {@code InvalidObjectException}, always.
* @throws ObjectStreamException always
*/
@java.io.Serial
private void readObjectNoData()
throws ObjectStreamException

View file

@ -1189,9 +1189,12 @@ public final class SocketPermission extends Permission
}
/**
* 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 @@ public final class SocketPermission extends Permission
}
/**
* 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 @@ final class SocketPermissionCollection extends PermissionCollection
};
/**
* 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 @@ final class SocketPermissionCollection extends PermissionCollection
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)

View file

@ -1777,6 +1777,9 @@ public final class URI
*
* @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 @@ public final class URI
*
* @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)

View file

@ -41,7 +41,15 @@ public class URISyntaxException
@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;
/**

View file

@ -1481,19 +1481,20 @@ public final class URL implements java.io.Serializable {
}
/**
* @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 @@ public final class URL implements java.io.Serializable {
* 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 @@ public final class URL implements java.io.Serializable {
* 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)

View file

@ -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 @@ public final class URLPermission extends Permission {
}
/**
* 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)

View file

@ -93,8 +93,9 @@ public final class UnixDomainSocketAddress extends SocketAddress {
* <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 {