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;
private AlpnSpec(String[] applicationProtocols) {
this.applicationProtocols = Collections.unmodifiableList(
Arrays.asList(applicationProtocols));
this.applicationProtocols = List.of(applicationProtocols);
}
private AlpnSpec(HandshakeContext hc,

View File

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

View File

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