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

Joe Darcy joe.darcy at oracle.com
Sat Aug 15 17:18:23 UTC 2020


On 8/13/2020 5:44 PM, Maurizio Cimadamore wrote:
> I personally like this suggestion a lot.
>
> I now realize that my main beef with "exposing" was that, by the time 
> I got to it, I half-forgot what caused the "exposing". This more 
> succint version rectifies that.
>
> Maurizio
>
> On 12/08/2020 19:14, Alex Buckley wrote:
>> compiler.warn.missing-explicit-ctor=\
>> class {0} declares no explicit constructors, exposing a default 
>> constructor to clients of module {2} 


How about

class {0} of exported package {1} declares no explicit constructors, 
exposing a default constructor to clients of module {2}

This more fully conveys the set of criteria necessary for the warning to 
be triggered.

As discussed earlier in the thread, I think it is best to keep command 
line help succinct:

javac.opt.Xlint.desc.missing-declared-ctor=\
     Warn about missing declared constructors in public classes in 
exported packages.

I like to get new warning pushed in the near future; always an 
opportunity for new instances to occur in the code base until the 
warning is enabled :-)

Thanks,

-Joe



More information about the compiler-dev mailing list