8370368: Apply java.io.Serial annotations in java.security.jgss

Reviewed-by: mullan
This commit is contained in:
Sergey Bylokhov 2025-10-27 07:38:28 +00:00
parent 3d2ce8045f
commit f5ef01d4bf
11 changed files with 38 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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.io.InvalidObjectException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.OutputStream;
import java.io.Serial;
import java.security.*;
import javax.security.auth.Subject;
import javax.security.auth.kerberos.KerberosCredMessage;
@ -1332,6 +1333,7 @@ class Krb5Context implements GSSContextSpi {
* The session key returned by inquireSecContext(KRB5_INQ_SSPI_SESSION_KEY)
*/
static class KerberosSessionKey implements Key {
@Serial
private static final long serialVersionUID = 699307378954123869L;
@SuppressWarnings("serial") // Not statically typed as Serializable
@ -1369,7 +1371,7 @@ class Krb5Context implements GSSContextSpi {
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
@Serial
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
throw new InvalidObjectException

View File

@ -402,7 +402,7 @@ public class Krb5InitCredential
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
@Serial
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
throw new InvalidObjectException("Krb5InitCredential not deserializable");

View File

@ -30,8 +30,11 @@
package sun.security.krb5;
import java.io.Serial;
public class Asn1Exception extends KrbException {
@Serial
private static final long serialVersionUID = 8291288984575084132L;
public Asn1Exception(int i) {

View File

@ -30,6 +30,8 @@
package sun.security.krb5;
import java.io.Serial;
/**
* KrbCryptoException is a wrapper exception for exceptions thrown by JCE.
*
@ -37,6 +39,7 @@ package sun.security.krb5;
*/
public class KrbCryptoException extends KrbException {
@Serial
private static final long serialVersionUID = -1657367919979982250L;
public KrbCryptoException(String s) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
@ -31,6 +31,7 @@
package sun.security.krb5;
import java.io.Serial;
import java.util.Objects;
import sun.security.krb5.internal.Krb5;
@ -38,6 +39,7 @@ import sun.security.krb5.internal.KRBError;
public class KrbException extends Exception {
@Serial
private static final long serialVersionUID = -4993302876451928596L;
private int returnCode;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
@ -31,8 +31,11 @@
package sun.security.krb5;
import java.io.Serial;
public class RealmException extends KrbException {
@Serial
private static final long serialVersionUID = -9100385213693792864L;
public RealmException(int i) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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 @@ import sun.security.krb5.RealmException;
import sun.security.util.*;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
@ -85,7 +86,8 @@ import static sun.security.krb5.internal.Krb5.DEBUG;
*/
public class KRBError implements java.io.Serializable {
static final long serialVersionUID = 3643809337475284503L;
@Serial
private static final long serialVersionUID = 3643809337475284503L;
private transient int pvno;
private transient int msgType;
@ -112,7 +114,7 @@ public class KRBError implements java.io.Serializable {
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
@java.io.Serial
@Serial
private void readObject(ObjectInputStream is)
throws IOException, ClassNotFoundException {
try {
@ -123,6 +125,7 @@ public class KRBError implements java.io.Serializable {
}
}
@Serial
private void writeObject(ObjectOutputStream os)
throws IOException {
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
@ -31,8 +31,11 @@
package sun.security.krb5.internal;
import java.io.Serial;
public class KdcErrException extends sun.security.krb5.KrbException {
@Serial
private static final long serialVersionUID = -8788186031117310306L;
public KdcErrException(int i) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
@ -31,8 +31,11 @@
package sun.security.krb5.internal;
import java.io.Serial;
public class KrbApErrException extends sun.security.krb5.KrbException {
@Serial
private static final long serialVersionUID = 7545264413323118315L;
public KrbApErrException(int i) {

View File

@ -30,8 +30,11 @@
package sun.security.krb5.internal;
import java.io.Serial;
public class KrbErrException extends sun.security.krb5.KrbException {
@Serial
private static final long serialVersionUID = 2186533836785448317L;
public KrbErrException(int i) {

View File

@ -36,6 +36,7 @@ import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Serial;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.util.Arrays;
@ -82,8 +83,8 @@ public class Ktab {
}
private static class ExitException extends RuntimeException {
@java.io.Serial
static final long serialVersionUID = 0L;
@Serial
private static final long serialVersionUID = 0L;
private final int errorCode;
public ExitException(int errorCode) {
this.errorCode = errorCode;