8274835: Remove unnecessary castings in java.base

Reviewed-by: mullan, naoto, lancea, bpb
This commit is contained in:
Andrey Turbanov 2021-11-12 16:30:56 +00:00 committed by Daniel Fuchs
parent 3b2585c02b
commit 5a2452c80e
15 changed files with 32 additions and 35 deletions

View file

@ -24,6 +24,7 @@
*/
package sun.net.www;
import jdk.internal.util.StaticProperty;
import java.io.*;
@ -89,7 +90,7 @@ public class MimeTable implements FileNameMap {
*/
public static FileNameMap loadTable() {
MimeTable mt = getDefaultTable();
return (FileNameMap)mt;
return mt;
}
public synchronized int getSize() {

View file

@ -77,7 +77,7 @@ public class AuthCacheImpl implements AuthCache {
}
if (skey == null) {
// list should contain only one element
return (AuthenticationInfo)list.get (0);
return list.get(0);
}
for (AuthCacheValue authCacheValue : list) {
AuthenticationInfo inf = (AuthenticationInfo) authCacheValue;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -122,7 +122,7 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
return null;
}
paramSpec = algParams.getParameterSpec(DSAParameterSpec.class);
return (DSAParams)paramSpec;
return paramSpec;
}
} catch (InvalidParameterSpecException e) {
return null;

View file

@ -291,7 +291,6 @@ class PKIX {
for (CertStore store : stores) {
try {
Collection<? extends Certificate> certs =
(Collection<? extends Certificate>)
store.getCertificates(sel);
if (!certs.isEmpty()) {
X509Certificate xc =

View file

@ -792,8 +792,7 @@ class RevocationChecker extends PKIXRevocationChecker {
e, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
}
RevocationStatus rs =
(RevocationStatus)response.getSingleResponse(certId);
RevocationStatus rs = response.getSingleResponse(certId);
RevocationStatus.CertStatus certStatus = rs.getCertStatus();
if (certStatus == RevocationStatus.CertStatus.REVOKED) {
Date revocationTime = rs.getRevocationTime();

View file

@ -1036,7 +1036,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
// Certs are immutable objects, therefore we don't clone them.
// But do need to clone the array, so that nothing is inserted
// into peerCerts.
return (java.security.cert.Certificate[])peerCerts.clone();
return peerCerts.clone();
}
/**
@ -1054,8 +1054,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
// clone to preserve integrity of session ... caller can't
// change record of peer identity even by accident, much
// less do it intentionally.
return (localCerts == null ? null :
(java.security.cert.Certificate[])localCerts.clone());
return (localCerts == null ? null : localCerts.clone());
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -80,7 +80,7 @@ public final class Era {
this.since = since;
this.localTime = localTime;
Gregorian gcal = CalendarSystem.getGregorianCalendar();
BaseCalendar.Date d = (BaseCalendar.Date) gcal.newCalendarDate(null);
BaseCalendar.Date d = gcal.newCalendarDate(null);
gcal.getCalendarDate(since, d);
sinceDate = new ImmutableGregorianDate(d);
}