Question on -Xlint:processing
Mark Mahieu
mark at twistedbanana.demon.co.uk
Sun Aug 24 06:23:12 PDT 2008
I guess it's worth mentioning that -g: also used to be considered a
valid option, but no longer is. I found out yesterday that NetBeans
specifies it when invoking javac.
Regards,
Mark
On 20 Aug 2008, at 21:49, Joe Darcy wrote:
> Hello.
>
> Yep, that's a bug; I've filed 6739427 "-Xlint:processing not
> recognized as an option" to track this. -Xlint:processing should
> be recognized a valid option.
>
> -Joe
>
> Peng Li wrote:
>> Hi,
>>
>> I noticed that the "-Xlint:processing" javac command line option is
>> broken in the recent openjdk7. It was never a officially documented
>> feature before, but it has been a working feature in earlier JDKs and
>> there are people using it.
>>
>> I investigated the issue and discovered several relevant facts in
>> langtools/src/share/classes/com/sun/tools/javac:
>>
>> (1) The following code assumes that Xlint:processing *is* a valid
>> Xlint option:
>>
>> processing/JavacProcessingEnvironment.java:
>> ...
>> lint = options.lint("processing");
>>
>> (2) The following code assumes that Xlint:processing is *not* a valid
>> Xlint option:
>>
>> code/Lint.java:
>> ...
>> public enum LintCategory
>>
>> (3) In the old openjdk code (20071030 and earlier), all command line
>> options starting with "-Xlint:" are recogonized as valid Xlint
>> options: even "-Xlint:junkfsdjlmcasl" is OK. The relevant code is in
>>
>> main/RecognizedOptions.java:
>> ...
>> new XOption(XLINT_CUSTOM,
>> "opt.Xlint.suboptlist") {
>> public boolean matches(String s) {
>> return s.startsWith("-Xlint:");
>>
>> A consequence is that, even though "-Xlint:processing" was not
>> enumerated as an valid option in code/Lint.java, it was accepted as a
>> valid Xlint option and used in
>> processing/JavacProcessingEnvironment.java
>>
>> (4) In the recent openjdk7 code, there is a change in the way valid
>> command line options are recognized:
>>
>>
>> main/RecognizedOptions.java:
>> ...
>> new XOption(XLINT_CUSTOM,
>> "opt.Xlint.suboptlist",
>> Option.ChoiceKind.ANYOF, getXLintChoices()),
>>
>> This is apparently an improvement over the old openjdk code
>> because
>> "-Xlint:junkfsdjlmcasl" will now be reported as an invalid option.
>> However, it also breaks all the software that uses the
>> "-Xlint:processing" feature:
>>
>> $ javac -Xlint:processing x.java
>> javac: invalid flag: -Xlint:processing
>> Usage: javac <options> <source files>
>> use -help for a list of possible options
>> $
>>
>> I hope this issue can be fixed in future openjdk versions. The most
>> important question seems to be whether "-Xlint:processing" should
>> be a
>> valid and supported option. If yes, the problem can be fixed by
>> simply adding a line in code/Lint.java to recognize the option. If
>> no, a clear-cut decision needs to be made and the code depending on
>> this option (for example, processing/JavacProcessingEnvironment.java)
>> should be fixed to avoid confusion for developers and users.
>>
>> Best regards,
>> Peng Li
>>
>
More information about the compiler-dev
mailing list