8250244: Address reliance on default constructors in java.net

Reviewed-by: alanb, vtewari
This commit is contained in:
Joe Darcy 2020-07-25 09:42:45 -07:00
parent ac4dc0470e
commit 0e54ce2a8e
12 changed files with 71 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,6 +74,11 @@ class Authenticator {
private RequestorType requestingAuthType; private RequestorType requestingAuthType;
private final String key = AuthenticatorKeys.computeKey(this); private final String key = AuthenticatorKeys.computeKey(this);
/**
* Constructor for subclasses to call.
*/
public Authenticator() {}
/** /**
* The type of the entity requesting authentication. * The type of the entity requesting authentication.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,6 +43,11 @@ import java.io.IOException;
*/ */
public abstract class CacheRequest { public abstract class CacheRequest {
/**
* Constructor for subclasses to call.
*/
public CacheRequest() {}
/** /**
* Returns an OutputStream to which the response body can be * Returns an OutputStream to which the response body can be
* written. * written.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -41,6 +41,11 @@ import java.io.IOException;
*/ */
public abstract class CacheResponse { public abstract class CacheResponse {
/**
* Constructor for subclasses to call.
*/
public CacheResponse() {}
/** /**
* Returns the response headers as a Map. * Returns the response headers as a Map.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -83,6 +83,11 @@ import java.io.IOException;
*/ */
public abstract class ContentHandler { public abstract class ContentHandler {
/**
* Constructor for subclasses to call.
*/
public ContentHandler() {}
/** /**
* Given a URL connect stream positioned at the beginning of the * Given a URL connect stream positioned at the beginning of the
* representation of an object, this method reads that stream and * representation of an object, this method reads that stream and

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,11 @@ import sun.security.util.SecurityConstants;
* @since 1.5 * @since 1.5
*/ */
public abstract class CookieHandler { public abstract class CookieHandler {
/**
* Constructor for subclasses to call.
*/
public CookieHandler() {}
/** /**
* The system-wide cookie handler that will apply cookies to the * The system-wide cookie handler that will apply cookies to the
* request headers and manage cookies from the response headers. * request headers and manage cookies from the response headers.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -57,6 +57,11 @@ import java.util.Set;
public abstract class DatagramSocketImpl implements SocketOptions { public abstract class DatagramSocketImpl implements SocketOptions {
/**
* Constructor for subclasses to call.
*/
public DatagramSocketImpl() {}
/** /**
* The local port number. * The local port number.
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -80,6 +80,11 @@ public abstract class ProxySelector {
} }
} }
/**
* Constructor for subclasses to call.
*/
public ProxySelector() {}
/** /**
* Gets the system-wide proxy selector. * Gets the system-wide proxy selector.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -60,6 +60,11 @@ import sun.security.util.SecurityConstants;
*/ */
public abstract class ResponseCache { public abstract class ResponseCache {
/**
* Constructor for subclasses to call.
*/
public ResponseCache() {}
/** /**
* The system wide cache that provides access to a url * The system wide cache that provides access to a url
* caching mechanism. * caching mechanism.

View file

@ -39,6 +39,11 @@ import java.util.Optional;
* @since 1.5 * @since 1.5
*/ */
public abstract class SecureCacheResponse extends CacheResponse { public abstract class SecureCacheResponse extends CacheResponse {
/**
* Constructor for subclasses to call.
*/
public SecureCacheResponse() {}
/** /**
* Returns the cipher suite in use on the original connection that * Returns the cipher suite in use on the original connection that
* retrieved the network resource. * retrieved the network resource.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,4 +43,8 @@ public abstract class SocketAddress implements java.io.Serializable {
@java.io.Serial @java.io.Serial
static final long serialVersionUID = 5215720748342549866L; static final long serialVersionUID = 5215720748342549866L;
/**
* Constructor for subclasses to call.
*/
public SocketAddress() {}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -81,6 +81,12 @@ import java.util.Objects;
public class URLDecoder { public class URLDecoder {
/**
* Do not call.
*/
@Deprecated(since="16", forRemoval=true)
public URLDecoder() {}
// The platform default encoding // The platform default encoding
static String dfltEncName = URLEncoder.dfltEncName; static String dfltEncName = URLEncoder.dfltEncName;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -51,6 +51,11 @@ import sun.net.www.ParseUtil;
* @since 1.0 * @since 1.0
*/ */
public abstract class URLStreamHandler { public abstract class URLStreamHandler {
/**
* Constructor for subclasses to call.
*/
public URLStreamHandler() {}
/** /**
* Opens a connection to the object referenced by the * Opens a connection to the object referenced by the
* {@code URL} argument. * {@code URL} argument.