Question on -Xlint:processing

Martin Buchholz martinrb at google.com
Wed Aug 20 16:54:46 PDT 2008


How about:

# HG changeset patch
# User martin
# Date 1219276355 25200
# Node ID f886a8dc226e6c07f6ee8106c8c6f5bbc4f980ec
# Parent  4026dece07e86ae75154c05b98ba342d00828ed7
6739427: -Xlint:processing not recognized as an option
Reviewed-by: darcy
Contributed-by: lipeng at google.com

diff --git a/src/share/classes/com/sun/tools/javac/code/Lint.java
b/src/share/classes/com/sun/tools/javac/code/Lint.java
--- a/src/share/classes/com/sun/tools/javac/code/Lint.java
+++ b/src/share/classes/com/sun/tools/javac/code/Lint.java
@@ -174,6 +174,11 @@
          * annotation.
          */
         PATH("path"),
+
+        /**
+         * Warn about issues regarding annotation processing.
+         */
+        PROCESSING("processing"),

         /**
          * Warn about Serializable classes that do not provide a
serial version ID.

Martin

On Wed, Aug 20, 2008 at 1:49 PM, Joe Darcy <Joe.Darcy at sun.com> 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