8229997: Apply java.io.Serial annotations in java.base

Reviewed-by: alanb, rriggs
This commit is contained in:
Joe Darcy 2019-08-29 16:31:34 -07:00
parent 6d064a747e
commit 9d764ee48e
315 changed files with 880 additions and 254 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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 @@ import java.net.SocketException;
*/
public
class ConnectionResetException extends SocketException {
@java.io.Serial
private static final long serialVersionUID = -7633185991801851556L;
public ConnectionResetException(String msg) {

View 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
@ -35,6 +35,7 @@ import java.io.*;
*/
public class TelnetProtocolException extends IOException {
@java.io.Serial
private static final long serialVersionUID = 8509127047257111343L;
public TelnetProtocolException(String s) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2009, 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
@ -34,6 +34,7 @@ import java.io.IOException;
* @author Jonathan Payne
*/
public class FtpLoginException extends IOException {
@java.io.Serial
private static final long serialVersionUID = 2218162403237941536L;
public FtpLoginException(String s) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2009, 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
@ -32,6 +32,7 @@ package sun.net.ftp;
* @author Jonathan Payne
*/
public class FtpProtocolException extends Exception {
@java.io.Serial
private static final long serialVersionUID = 5978077070276545054L;
private final FtpReplyCode code;

View file

@ -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
@ -32,6 +32,7 @@ import java.io.IOException;
* an SMTP session.
*/
public class SmtpProtocolException extends IOException {
@java.io.Serial
private static final long serialVersionUID = -7547136771133814908L;
SmtpProtocolException(String s) {

View file

@ -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 sun.net.www;
*/
public class ApplicationLaunchException extends Exception {
@java.io.Serial
private static final long serialVersionUID = -4782286141289536883L;
public ApplicationLaunchException(String reason) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, 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
@ -49,6 +49,7 @@ import sun.security.action.GetIntegerAction;
public class KeepAliveCache
extends HashMap<KeepAliveKey, ClientVector>
implements Runnable {
@java.io.Serial
private static final long serialVersionUID = -2937172892064557949L;
/* maximum # keep-alive connections to maintain at once
@ -203,10 +204,12 @@ public class KeepAliveCache
/*
* Do not serialize this class!
*/
@java.io.Serial
private void writeObject(ObjectOutputStream stream) throws IOException {
throw new NotSerializableException();
}
@java.io.Serial
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
@ -218,6 +221,7 @@ public class KeepAliveCache
* to time them out. If > maxConns are in use, block.
*/
class ClientVector extends ArrayDeque<KeepAliveEntry> {
@java.io.Serial
private static final long serialVersionUID = -8680532108106489459L;
// sleep time in milliseconds, before cache clear
@ -268,10 +272,12 @@ class ClientVector extends ArrayDeque<KeepAliveEntry> {
/*
* Do not serialize this class!
*/
@java.io.Serial
private void writeObject(ObjectOutputStream stream) throws IOException {
throw new NotSerializableException();
}
@java.io.Serial
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, 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
@ -37,6 +37,7 @@ import java.net.PasswordAuthentication;
public abstract class AuthCacheValue implements Serializable {
@java.io.Serial
static final long serialVersionUID = 735249334068211611L;
public enum Type {

View file

@ -53,6 +53,7 @@ import sun.net.www.HeaderParser;
public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable {
@java.io.Serial
static final long serialVersionUID = -2588378268010453259L;
// Constants saying what kind of authroization this is. This determines
@ -498,6 +499,7 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
String s1, s2; /* used for serialization of pw */
@java.io.Serial
private synchronized void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
@ -509,6 +511,7 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
}
}
@java.io.Serial
private synchronized void writeObject(java.io.ObjectOutputStream s)
throws IOException
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, 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
@ -51,6 +51,7 @@ import static java.nio.charset.StandardCharsets.ISO_8859_1;
class BasicAuthentication extends AuthenticationInfo {
@java.io.Serial
private static final long serialVersionUID = 100L;
/** The authentication string for this host, port, and realm. This is

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, 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
@ -50,6 +50,7 @@ import static sun.net.www.protocol.http.HttpURLConnection.HTTP_CONNECT;
class DigestAuthentication extends AuthenticationInfo {
@java.io.Serial
private static final long serialVersionUID = 100L;
private String authMethod;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, 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
@ -45,6 +45,7 @@ import sun.security.action.GetPropertyAction;
class NegotiateAuthentication extends AuthenticationInfo {
@java.io.Serial
private static final long serialVersionUID = 100L;
private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();