8259069: Fields could be final

Reviewed-by: wetmore
This commit is contained in:
Xue-Lei Andrew Fan 2021-01-05 00:11:55 +00:00
parent f0aae81ed5
commit 2499ac3db5
13 changed files with 33 additions and 32 deletions

View File

@ -67,7 +67,7 @@ final class DHClientKeyExchange {
*/
private static final
class DHClientKeyExchangeMessage extends HandshakeMessage {
private byte[] y; // 1 to 2^16 - 1 bytes
private final byte[] y; // 1 to 2^16 - 1 bytes
DHClientKeyExchangeMessage(
HandshakeContext handshakeContext) throws IOException {

View File

@ -109,7 +109,7 @@ final class EphemeralKeyManager {
private KeyPair keyPair;
private int uses;
private long expirationTime;
private final long expirationTime;
private EphemeralKeyPair(KeyPair keyPair) {
this.keyPair = keyPair;

View File

@ -122,9 +122,9 @@ abstract class HelloCookieManager {
class D10HelloCookieManager extends HelloCookieManager {
final SecureRandom secureRandom;
private int cookieVersion; // allow to wrap, version + sequence
private byte[] cookieSecret;
private byte[] legacySecret;
private int cookieVersion; // allow to wrap, version + sequence
private final byte[] cookieSecret;
private final byte[] legacySecret;
private final ReentrantLock d10ManagerLock = new ReentrantLock();

View File

@ -225,7 +225,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
private static class SupportedSignatureAlgorithmConstraints
implements AlgorithmConstraints {
// supported signature algorithms
private String[] supportedAlgorithms;
private final String[] supportedAlgorithms;
SupportedSignatureAlgorithmConstraints(String[] supportedAlgorithms) {
if (supportedAlgorithms != null) {

View File

@ -411,7 +411,7 @@ enum SSLCipher {
private static final HashMap<String, Long> cipherLimits = new HashMap<>();
// Keywords found on the jdk.tls.keyLimits security property.
final static String tag[] = {"KEYUPDATE"};
final static String[] tag = {"KEYUPDATE"};
static {
final long max = 4611686018427387904L; // 2^62
@ -424,12 +424,12 @@ enum SSLCipher {
});
if (prop != null) {
String propvalue[] = prop.split(",");
String[] propvalue = prop.split(",");
for (String entry : propvalue) {
int index;
// If this is not a UsageLimit, goto to next entry.
String values[] = entry.trim().toUpperCase().split(" ");
String[] values = entry.trim().toUpperCase().split(" ");
if (values[1].contains(tag[0])) {
index = 0;

View File

@ -434,7 +434,7 @@ final class SSLConfiguration implements Cloneable {
//
// See Effective Java Second Edition: Item 71.
private static final class CustomizedClientSignatureSchemes {
private static List<SignatureScheme> signatureSchemes =
private static final List<SignatureScheme> signatureSchemes =
getCustomizedSignatureScheme("jdk.tls.client.SignatureSchemes");
}
@ -442,7 +442,7 @@ final class SSLConfiguration implements Cloneable {
//
// See Effective Java Second Edition: Item 71.
private static final class CustomizedServerSignatureSchemes {
private static List<SignatureScheme> signatureSchemes =
private static final List<SignatureScheme> signatureSchemes =
getCustomizedSignatureScheme("jdk.tls.server.SignatureSchemes");
}

View File

@ -371,7 +371,8 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord {
}
final class HandshakeFragment {
private LinkedList<RecordMemo> handshakeMemos = new LinkedList<>();
private final LinkedList<RecordMemo> handshakeMemos =
new LinkedList<>();
void queueUpFragment(byte[] source,
int offset, int length) throws IOException {

View File

@ -38,7 +38,7 @@ import sun.security.util.HexDumpEncoder;
*/
final class SSLExtensions {
private final HandshakeMessage handshakeMessage;
private Map<SSLExtension, byte[]> extMap = new LinkedHashMap<>();
private final Map<SSLExtension, byte[]> extMap = new LinkedHashMap<>();
private int encodedLength;
// Extension map for debug logging

View File

@ -265,78 +265,78 @@ final class SSLKeyExchange implements SSLKeyAgreementGenerator,
}
private static class SSLKeyExRSA {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA), T12KeyAgreement.RSA);
}
private static class SSLKeyExRSAExport {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA), T12KeyAgreement.RSA_EXPORT);
}
private static class SSLKeyExDHEDSS {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.DSA), T12KeyAgreement.DHE);
}
private static class SSLKeyExDHEDSSExport {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.DSA), T12KeyAgreement.DHE_EXPORT);
}
private static class SSLKeyExDHERSA {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA), T12KeyAgreement.DHE);
}
private static class SSLKeyExDHERSAOrPSS {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA_OR_PSS), T12KeyAgreement.DHE);
}
private static class SSLKeyExDHERSAExport {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA), T12KeyAgreement.DHE_EXPORT);
}
private static class SSLKeyExDHANON {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
null, T12KeyAgreement.DHE);
}
private static class SSLKeyExDHANONExport {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
null, T12KeyAgreement.DHE_EXPORT);
}
private static class SSLKeyExECDHECDSA {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.EC), T12KeyAgreement.ECDH);
}
private static class SSLKeyExECDHRSA {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.EC), T12KeyAgreement.ECDH);
}
private static class SSLKeyExECDHEECDSA {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.EC, X509Authentication.EDDSA),
T12KeyAgreement.ECDHE);
}
private static class SSLKeyExECDHERSA {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA), T12KeyAgreement.ECDHE);
}
private static class SSLKeyExECDHERSAOrPSS {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
List.of(X509Authentication.RSA_OR_PSS), T12KeyAgreement.ECDHE);
}
private static class SSLKeyExECDHANON {
private static SSLKeyExchange KE = new SSLKeyExchange(
private static final SSLKeyExchange KE = new SSLKeyExchange(
null, T12KeyAgreement.ECDHE);
}

View File

@ -125,7 +125,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/*
* Use of session caches is globally enabled/disabled.
*/
private static boolean defaultRejoinable = true;
private static final boolean defaultRejoinable = true;
// server name indication
final SNIServerName serverNameIndication;

View File

@ -56,7 +56,7 @@ public class SunJSSE extends java.security.Provider {
@java.io.Serial
private static final long serialVersionUID = 3231825739635378733L;
private static String info = "Sun JSSE provider" +
private static final String info = "Sun JSSE provider" +
"(PKCS12, SunX509/PKIX key/trust factories, " +
"SSLv3/TLSv1/TLSv1.1/TLSv1.2/TLSv1.3/DTLSv1.0/DTLSv1.2)";

View File

@ -87,7 +87,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* The credentials from the KeyStore as
* Map: String(alias) -> X509Credentials(credentials)
*/
private Map<String,X509Credentials> credentialsMap;
private final Map<String,X509Credentials> credentialsMap;
/*
* Cached server aliases for the case issuers == null.

View File

@ -149,7 +149,7 @@ final class TrustStoreManager {
for (String fileName : fileNames) {
File f = new File(fileName);
if (f.isFile() && f.canRead()) {
temporaryName = fileName;;
temporaryName = fileName;
temporaryFile = f;
temporaryTime = f.lastModified();