mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +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) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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.lang.reflect;
|
|||
* @since 1.5
|
||||
*/
|
||||
public class GenericSignatureFormatError extends ClassFormatError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 6709919147137911034L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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.lang.reflect;
|
|||
*/
|
||||
|
||||
public class InaccessibleObjectException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 4158786093378140901L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2004, 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 @@ public class InvocationTargetException extends ReflectiveOperationException {
|
|||
/**
|
||||
* Use serialVersionUID from JDK 1.1.X for interoperability
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 4085088731926701167L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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.lang.reflect;
|
|||
* @since 1.5
|
||||
*/
|
||||
public class MalformedParameterizedTypeException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -5696557788586220964L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
|
@ -53,6 +53,7 @@ public class MalformedParametersException extends RuntimeException {
|
|||
/**
|
||||
* Version for serialization.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 20130919L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -283,6 +283,7 @@ import static java.lang.module.ModuleDescriptor.Modifier.SYNTHETIC;
|
|||
* @spec JPMS
|
||||
*/
|
||||
public class Proxy implements java.io.Serializable {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -2222568056686623797L;
|
||||
|
||||
/** parameter types of a proxy class constructor */
|
||||
|
|
|
@ -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
|
||||
|
@ -79,6 +79,7 @@ package java.lang.reflect;
|
|||
public final
|
||||
class ReflectPermission extends java.security.BasicPermission {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 7412737110241507485L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
|
@ -62,6 +62,7 @@ import jdk.internal.access.SharedSecrets;
|
|||
* @since 1.3
|
||||
*/
|
||||
public class UndeclaredThrowableException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 330127114055056639L;
|
||||
|
||||
/**
|
||||
|
@ -108,6 +109,7 @@ public class UndeclaredThrowableException extends RuntimeException {
|
|||
*
|
||||
* @serialField undeclaredThrowable Throwable
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("undeclaredThrowable", Throwable.class)
|
||||
};
|
||||
|
@ -117,6 +119,7 @@ public class UndeclaredThrowableException extends RuntimeException {
|
|||
* and initialize the cause properly when deserializing from an older
|
||||
* version.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
|
||||
ObjectInputStream.GetField fields = s.readFields();
|
||||
Throwable exception = (Throwable) fields.get("undeclaredThrowable", null);
|
||||
|
@ -129,6 +132,7 @@ public class UndeclaredThrowableException extends RuntimeException {
|
|||
* To maintain compatibility with older implementation, write a serial
|
||||
* "ex" field with the cause as the value.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void writeObject(ObjectOutputStream out) throws IOException {
|
||||
ObjectOutputStream.PutField fields = out.putFields();
|
||||
fields.put("undeclaredThrowable", super.getCause());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue