mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +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
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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,6 +33,7 @@ package java.io;
|
|||
public class CharConversionException
|
||||
extends java.io.IOException
|
||||
{
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8680016352018427031L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 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
|
||||
|
@ -40,6 +40,7 @@ package java.io;
|
|||
*/
|
||||
public
|
||||
class EOFException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 6433858223774886977L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2217,6 +2217,7 @@ public class File
|
|||
*
|
||||
* @serialData Default fields followed by separator character.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private synchronized void writeObject(java.io.ObjectOutputStream s)
|
||||
throws IOException
|
||||
{
|
||||
|
@ -2230,6 +2231,7 @@ public class File
|
|||
* than the separator character on this system, then the old separator
|
||||
* is replaced by the local separator.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private synchronized void readObject(java.io.ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
|
@ -2251,6 +2253,7 @@ public class File
|
|||
= UNSAFE.objectFieldOffset(File.class, "prefixLength");
|
||||
|
||||
/** use serialVersionUID from JDK 1.0.2 for interoperability */
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 301077366599181567L;
|
||||
|
||||
// -- Integration with java.nio.file --
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
|
@ -41,6 +41,7 @@ package java.io;
|
|||
*/
|
||||
|
||||
public class FileNotFoundException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -897856973823710492L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -195,6 +195,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||
// return sb.toString();
|
||||
// }
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 7930732926638008763L;
|
||||
|
||||
/**
|
||||
|
@ -1040,6 +1041,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||
* to a stream. The actions are serialized, and the superclass
|
||||
* takes care of the name.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void writeObject(ObjectOutputStream s)
|
||||
throws IOException
|
||||
{
|
||||
|
@ -1054,6 +1056,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||
* readObject is called to restore the state of the FilePermission from
|
||||
* a stream.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
|
@ -1210,6 +1213,7 @@ final class FilePermissionCollection extends PermissionCollection
|
|||
return perms.elements();
|
||||
}
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 2202956749081564585L;
|
||||
|
||||
// Need to maintain serialization interoperability with earlier releases,
|
||||
|
@ -1220,6 +1224,7 @@ final class FilePermissionCollection extends PermissionCollection
|
|||
* @serialField permissions java.util.Vector
|
||||
* A list of FilePermission objects.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("permissions", Vector.class),
|
||||
};
|
||||
|
@ -1231,6 +1236,7 @@ final class FilePermissionCollection extends PermissionCollection
|
|||
* Writes the contents of the perms field out as a Vector for
|
||||
* serialization compatibility with earlier releases.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void writeObject(ObjectOutputStream out) throws IOException {
|
||||
// Don't call out.defaultWriteObject()
|
||||
|
||||
|
@ -1245,6 +1251,7 @@ final class FilePermissionCollection extends PermissionCollection
|
|||
/*
|
||||
* Reads in a Vector of FilePermissions and saves them in the perms field.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(ObjectInputStream in)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
|
@ -46,5 +46,6 @@ public class IOError extends Error {
|
|||
super(cause);
|
||||
}
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 67100927991680413L;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
|
@ -37,6 +37,7 @@ package java.io;
|
|||
*/
|
||||
public
|
||||
class IOException extends Exception {
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 7818375828146090155L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 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
|
||||
|
@ -41,6 +41,7 @@ package java.io;
|
|||
*/
|
||||
public
|
||||
class InterruptedIOException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 4020568460727500567L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -40,6 +40,7 @@ package java.io;
|
|||
*/
|
||||
public class InvalidClassException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4333316296251054416L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -37,6 +37,7 @@ package java.io;
|
|||
*/
|
||||
public class InvalidObjectException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 3233174318281839583L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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,6 +33,7 @@ package java.io;
|
|||
*/
|
||||
public class NotActiveException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -3893467273049808895L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -35,6 +35,7 @@ package java.io;
|
|||
*/
|
||||
public class NotSerializableException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 2906642554793891381L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,7 +84,9 @@ public class ObjectStreamClass implements Serializable {
|
|||
public static final ObjectStreamField[] NO_FIELDS =
|
||||
new ObjectStreamField[0];
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -6120832682080437368L;
|
||||
@java.io.Serial
|
||||
private static final ObjectStreamField[] serialPersistentFields =
|
||||
NO_FIELDS;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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,6 +33,7 @@ package java.io;
|
|||
*/
|
||||
public abstract class ObjectStreamException extends IOException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 7260898174833392607L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -47,6 +47,7 @@ package java.io;
|
|||
*/
|
||||
public class OptionalDataException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8011121865681257820L;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -101,6 +101,7 @@ import java.util.StringTokenizer;
|
|||
|
||||
public final class SerializablePermission extends BasicPermission {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 8537212141160296410L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -34,6 +34,7 @@ package java.io;
|
|||
*/
|
||||
public class StreamCorruptedException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 8983558202217591746L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -34,6 +34,7 @@ package java.io;
|
|||
* @since 1.1
|
||||
*/
|
||||
public class SyncFailedException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -2353342684412443330L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 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
|
||||
|
@ -44,6 +44,7 @@ package java.io;
|
|||
*/
|
||||
public
|
||||
class UTFDataFormatException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 420743449228280612L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
|
@ -32,6 +32,7 @@ import java.util.Objects;
|
|||
* @since 1.8
|
||||
*/
|
||||
public class UncheckedIOException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8134305061645241065L;
|
||||
|
||||
/**
|
||||
|
@ -79,6 +80,7 @@ public class UncheckedIOException extends RuntimeException {
|
|||
* if the object is invalid or has a cause that is not
|
||||
* an {@code IOException}
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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,6 +33,7 @@ package java.io;
|
|||
public class UnsupportedEncodingException
|
||||
extends IOException
|
||||
{
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4274276298326136670L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -44,6 +44,7 @@ package java.io;
|
|||
* @since 1.1
|
||||
*/
|
||||
public class WriteAbortedException extends ObjectStreamException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -3326426625597282442L;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue