Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8319230

-Werror turns incubator module warning to an error

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 22
    • tools
    • None
    • behavioral
    • minimal
    • Disabled incubating module warning based on a new lint category switch does not represent a compatibility risk.
    • Java API, add/remove/modify command line option
    • JDK

      Summary

      Add default-on lint category "incubating" and trigger incubating module warning according to the category.

      Problem

      Incubating module warning is not suppressible and -Werror turns incubator module warning to an error.

      Solution

      Add default-on lint category "incubating" and disable incubating module warning at compile time when the category is disabled.

      Specification

      diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java
      index e9d64a6ad72..de37229f68f 100644
      --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java
      +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java
      @@ -130,6 +130,7 @@ protected Lint(Context context) {
                       values.add(LintCategory.PREVIEW);
                   }
                   values.add(LintCategory.SYNCHRONIZATION);
      +            values.add(LintCategory.INCUBATING);
               }
      
               // Look for specific overrides
      @@ -215,6 +216,11 @@ public enum LintCategory {
                */
               FINALLY("finally"),
      +
      +        /**
      +         * Warn about use of incubating modules.
      +         */
      +        INCUBATING("incubating"),
      
               /**
                 * Warn about compiler possible lossy conversions.
                 */
      diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
      index d9bd05ba62a..7893d328afa 100644
      --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
      +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
      @@ -213,6 +213,9 @@ javac.opt.Xlint.desc.fallthrough=\
       javac.opt.Xlint.desc.finally=\
           Warn about finally clauses that do not terminate normally.
      
      +javac.opt.Xlint.desc.incubating=\
      +    Warn about use of incubating modules.
      +
       javac.opt.Xlint.desc.lossy-conversions=\
           Warn about possible lossy conversions in compound assignment.
      
      diff --git a/src/jdk.compiler/share/classes/module-info.java b/src/jdk.compiler/share/classes/module-info.java
      index c8716233c0f..9826b3f576b 100644
      --- a/src/jdk.compiler/share/classes/module-info.java
      +++ b/src/jdk.compiler/share/classes/module-info.java
      @@ -162,6 +162,7 @@
        * <tr><th scope="row">{@code fallthrough}          <td>falling through from one case of a {@code switch} statement to
        *                                                      the next
        * <tr><th scope="row">{@code finally}              <td>{@code finally} clauses that do not terminate normally
      + * <tr><th scope="row">{@code incubating}           <td>use of incubating modules
        * <tr><th scope="row">{@code lossy-conversions}    <td>possible lossy conversions in compound assignment
        * <tr><th scope="row">{@code missing-explicit-ctor} <td>missing explicit constructors in public and protected classes
        *                                                      in exported packages
      diff --git a/src/jdk.compiler/share/man/javac.1 b/src/jdk.compiler/share/man/javac.1
      index 30b260ac648..b8a7fe60af5 100644
      --- a/src/jdk.compiler/share/man/javac.1
      +++ b/src/jdk.compiler/share/man/javac.1
      @@ -725,6 +725,8 @@ a switch statement to the next.
       \f[V]finally\f[R]: Warns about \f[V]finally\f[R] clauses that do not
       terminate normally.
       .IP \[bu] 2
      +\f[V]incubating\f[R]: Warns about the use of incubating modules.
      +.IP \[bu] 2
       \f[V]lossy-conversions\f[R]: Warns about possible lossy conversions in
       compound assignment.
       .IP \[bu] 2
      

            asotona Adam Sotona
            mchung Mandy Chung (Inactive)
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: