JDK 16 RFR of JDK-8071961: Add javac lint warning when a default constructor is created

Joe Darcy joe.darcy at oracle.com
Mon Aug 17 22:51:43 UTC 2020


On 8/17/2020 3:24 PM, Alex Buckley wrote:
> On 8/17/2020 2:18 PM, Jonathan Gibbons wrote> On 8/17/20 9:29 AM, Alex 
> Buckley wrote:
>>>
>>> compiler.warn.missing-explicit-ctor=\
>>> class {0} in exported package {1} declares no explicit constructors, 
>>> exposing a default constructor to clients of module {2} 
>>
>> Is it just me, or does "declares no explicit constructors" sound 
>> weirdly stilted, as compared to something like "does not declare any 
>> explicit constructors" or "does not explicitly declare any 
>> constructors".
>
> I know what you mean. If the message was an independent clause 
> (stopping at the comma), then I'd agree that "class ... does not 
> explicitly declare any constructors" is best. However, the message 
> tacks on a dependent clause to suggest an untoward effect on clients. 
> The advantage of "declares no ...", besides using fewer words, is that 
> it has the same positive phrasing as "exposing a ...", so the cause 
> and effect is clearer: class ... declares X, exposing Y. All that 
> said, I have no problem with Joe phrasing it with more words, as long 
> as "explicit" ctors are front and center.
>
Going once, going twice:

class {0} in exported package {1} does not declare any explicit 
constructors, exposing a default constructor to clients of module {2}

-Joe



More information about the compiler-dev mailing list