mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8229997: Apply java.io.Serial annotations in java.base
Reviewed-by: alanb, rriggs
This commit is contained in:
parent
6d064a747e
commit
9d764ee48e
315 changed files with 880 additions and 254 deletions
|
@ -299,6 +299,7 @@ class InetAddress implements java.io.Serializable {
|
|||
private transient String canonicalHostName = null;
|
||||
|
||||
/** use serialVersionUID from JDK 1.0.2 for interoperability */
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 3286316764910316507L;
|
||||
|
||||
/*
|
||||
|
@ -353,6 +354,7 @@ class InetAddress implements java.io.Serializable {
|
|||
* @throws ObjectStreamException if a new object replacing this
|
||||
* object could not be created
|
||||
*/
|
||||
@java.io.Serial
|
||||
private Object readResolve() throws ObjectStreamException {
|
||||
// will replace the deserialized 'this' object
|
||||
return new Inet4Address(holder().getHostName(), holder().getAddress());
|
||||
|
@ -1687,6 +1689,7 @@ class InetAddress implements java.io.Serializable {
|
|||
return (InetAddressImpl) impl;
|
||||
}
|
||||
|
||||
@java.io.Serial
|
||||
private void readObjectNoData () {
|
||||
if (getClass().getClassLoader() != null) {
|
||||
throw new SecurityException ("invalid address type");
|
||||
|
@ -1698,6 +1701,7 @@ class InetAddress implements java.io.Serializable {
|
|||
private static final long FIELDS_OFFSET
|
||||
= UNSAFE.objectFieldOffset(InetAddress.class, "holder");
|
||||
|
||||
@java.io.Serial
|
||||
private void readObject (ObjectInputStream s) throws
|
||||
IOException, ClassNotFoundException {
|
||||
if (getClass().getClassLoader() != null) {
|
||||
|
@ -1721,12 +1725,14 @@ class InetAddress implements java.io.Serializable {
|
|||
* @serialField address int
|
||||
* @serialField family int
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("hostName", String.class),
|
||||
new ObjectStreamField("address", int.class),
|
||||
new ObjectStreamField("family", int.class),
|
||||
};
|
||||
|
||||
@java.io.Serial
|
||||
private void writeObject (ObjectOutputStream s) throws
|
||||
IOException {
|
||||
if (getClass().getClassLoader() != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue