JDK 16 RFR of JDK-8250244: Address reliance on default constructors in java.net
Joe Darcy
joe.darcy at oracle.com
Fri Jul 24 17:42:33 UTC 2020
Hi Alan,
On 7/24/2020 3:34 AM, Alan Bateman wrote:
> On 24/07/2020 01:33, Joe Darcy wrote:
>> Hello,
>>
>> Please review the replacement of default constructors in various
>> abstract classes in java.net with explicit constructors:
>>
>> webrev: http://cr.openjdk.java.net/~darcy/8250244.0/
>> CSR: https://bugs.openjdk.java.net/browse/JDK-8250245
>>
>> (This is part of a larger effort to remove default constructor usage
>> from the JDK in preparation for enabling a new lint warning.)
> Could we use the opportunity to change some of these to be protected?
> For some of these then I don't think there is any compatibility impact.
>
At least from a few minutes thinking, I don't see a meaningful
compatibility issue in replacing
1) a public constructor in an abstract class
with
2) a protected constructor in an abstract class
It is source compatible, subclasses would have access to the constructor
in either case, and should also be binary compatible as linkage
shouldn't be impacted (because subclasses would still have access to the
constructor).
That said, for this exercise I'd prefer to replace the implicit default
constructors with equivalent explicit ones, but would be open to future
refinements to make the constructors protected.
Thanks,
-Joe
More information about the net-dev
mailing list