8233958: Memory retention due to HttpsURLConnection finalizer that serves no purpose
Reviewed-by: dfuchs, rriggs
--- a/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java Wed Nov 13 08:43:35 2019 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java Wed Nov 13 09:09:41 2019 +0000
@@ -72,13 +72,4 @@
protected javax.net.ssl.HostnameVerifier getHostnameVerifier() {
return httpsURLConnection.getHostnameVerifier();
}
-
- /*
- * Called by layered delegator's finalize() method to handle closing
- * the underlying object.
- */
- @SuppressWarnings("deprecation")
- protected void dispose() throws Throwable {
- super.finalize();
- }
}
--- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java Wed Nov 13 08:43:35 2019 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java Wed Nov 13 09:09:41 2019 +0000
@@ -461,16 +461,6 @@
delegate.setDefaultUseCaches(defaultusecaches);
}
- /*
- * finalize (dispose) the delegated object. Otherwise
- * sun.net.www.protocol.http.HttpURLConnection's finalize()
- * would have to be made public.
- */
- @SuppressWarnings("deprecation")
- protected void finalize() throws Throwable {
- delegate.dispose();
- }
-
public boolean equals(Object obj) {
return this == obj || ((obj instanceof HttpsURLConnectionImpl) &&
delegate.equals(((HttpsURLConnectionImpl)obj).delegate));