8258514: Replace Collections.unmodifiableList with List.of

Reviewed-by: jnimeh
This commit is contained in:
Xue-Lei Andrew Fan 2020-12-16 19:42:03 +00:00
parent 59f4c4aad5
commit efd61c6f53
3 changed files with 3 additions and 6 deletions

View file

@ -85,8 +85,7 @@ final class AlpnExtension {
final List<String> applicationProtocols; final List<String> applicationProtocols;
private AlpnSpec(String[] applicationProtocols) { private AlpnSpec(String[] applicationProtocols) {
this.applicationProtocols = Collections.unmodifiableList( this.applicationProtocols = List.of(applicationProtocols);
Arrays.asList(applicationProtocols));
} }
private AlpnSpec(HandshakeContext hc, private AlpnSpec(HandshakeContext hc,

View file

@ -198,8 +198,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
Collections.unmodifiableCollection( Collections.unmodifiableCollection(
new ArrayList<>(hc.localSupportedSignAlgs)); new ArrayList<>(hc.localSupportedSignAlgs));
this.serverNameIndication = hc.negotiatedServerName; this.serverNameIndication = hc.negotiatedServerName;
this.requestedServerNames = Collections.unmodifiableList( this.requestedServerNames = List.copyOf(hc.getRequestedServerNames());
new ArrayList<>(hc.getRequestedServerNames()));
if (hc.sslConfig.isClientMode) { if (hc.sslConfig.isClientMode) {
this.useExtendedMasterSecret = this.useExtendedMasterSecret =
(hc.handshakeExtensions.get( (hc.handshakeExtensions.get(

View file

@ -89,8 +89,7 @@ final class ServerNameExtension {
* (see JDK-6323374). * (see JDK-6323374).
*/ */
private CHServerNamesSpec(List<SNIServerName> serverNames) { private CHServerNamesSpec(List<SNIServerName> serverNames) {
this.serverNames = Collections.<SNIServerName>unmodifiableList( this.serverNames = List.copyOf(serverNames);
new ArrayList<>(serverNames));
} }
private CHServerNamesSpec(HandshakeContext hc, private CHServerNamesSpec(HandshakeContext hc,