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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Aug 17 16:01:16 UTC 2020


On 15/08/2020 18:18, Joe Darcy wrote:
> 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}
Looks good to me - not 100% about use of the word "of" vs. "in" (e.g. 
class of exported package, vs. class in exported package)
>
> 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 agree this has to be succint - in sync with other help messages.

Maurizio

>
> 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