Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8259069: Fields could be final
Reviewed-by: wetmore
  • Loading branch information
XueleiFan committed Jan 5, 2021
1 parent f0aae81 commit 2499ac3db5c4a336059263a929031b4eef2d0f0a
@@ -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 {
@@ -109,7 +109,7 @@ private static class EphemeralKeyPair {

private KeyPair keyPair;
private int uses;
private long expirationTime;
private final long expirationTime;

private EphemeralKeyPair(KeyPair keyPair) {
this.keyPair = keyPair;
@@ -122,9 +122,9 @@ abstract boolean isCookieValid(ServerHandshakeContext context,
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();

@@ -225,7 +225,7 @@ public boolean permits(Set<CryptoPrimitive> primitives,
private static class SupportedSignatureAlgorithmConstraints
implements AlgorithmConstraints {
// supported signature algorithms
private String[] supportedAlgorithms;
private final String[] supportedAlgorithms;

SupportedSignatureAlgorithmConstraints(String[] supportedAlgorithms) {
if (supportedAlgorithms != null) {
@@ -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 @@ public String run() {
});

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;
@@ -434,15 +434,15 @@ public Object clone() {
//
// 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");
}

// lazy initialization holder class idiom for static default parameters
//
// 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");
}

@@ -371,7 +371,8 @@ private static class HandshakeMemo extends RecordMemo {
}

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 {
@@ -38,7 +38,7 @@
*/
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
@@ -265,78 +265,78 @@ static SSLKeyExchange valueOf(NamedGroup namedGroup) {
}

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);
}

@@ -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;
@@ -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)";

@@ -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.
@@ -149,7 +149,7 @@ public TrustStoreDescriptor run() {
for (String fileName : fileNames) {
File f = new File(fileName);
if (f.isFile() && f.canRead()) {
temporaryName = fileName;;
temporaryName = fileName;
temporaryFile = f;
temporaryTime = f.lastModified();

0 comments on commit 2499ac3

Please sign in to comment.