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

doclint throws missing comment warnings on lines which can't even have javadoc

    Details

    • Subcomponent:
    • Resolved In Build:
      b39
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        $ java -version
        java version "1.8.0_152"
        Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
        Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)


        A DESCRIPTION OF THE PROBLEM :
        Running javac with -Xdoclint:all occasionally produces warnings about missing Javadoc comments on code which normally does not usually have (and in many cases cannot have) Javadoc.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        javac -Xdoclint:all -Werror acme/MyClass.java


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        No warnings emitted and command succeeds.
        ACTUAL -
        2 warnings are emitted, the first of them on the parameter to the lambda and the second on the local variable:



        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        /.../acme/MyClass.java:16: warning: no comment
            static final Function<String, String> someFunction = string -> {
                                                                 ^
        /.../acme/MyClass.java:18: warning: no comment
                int localVariable = 3;
                    ^
        error: warnings found and -Werror specified
        1 error
        2 warnings


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package acme;

        import java.util.Arrays;
        import java.util.Set;
        import java.util.function.Function;

        /**
         * The class has docs.
         */
        public final class MyClass
        {
            /**
             * The field itself has docs.
             */
            // Spurious warning 1 here, at 'string ->'
            static final Function<String, String> someFunction = string -> {
                // Spurious warning 2 here, at 'localVariable'
                int localVariable = 3;
                return Integer.toString(localVariable);
            };
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Not using doclint is a workaround, but we want to use it, because we'd like to report Javadoc issues as soon as possible.


          Activity

          Hide
          fmatte Fairoz Matte added a comment -
          This issue is reproducible in all the versions of 8 9 and 10
          Below is the results on 10 ea b36
          ==
          -sh-4.2$ /scratch/fairoz/JAVA/jdk10/jdk-10-ea+36/bin/javac -Xdoclint:all -Werror MyClass.java
          MyClass.java:14: warning: no comment
               static final Function<String, String> someFunction = string -> {
                                                                    ^
          MyClass.java:16: warning: no comment
                  int localVariable = 3;
                      ^
          error: warnings found and -Werror specified
          1 error
          2 warnings

          8 GA - Fail
          9 GA - Fail
          9.0.1 GA - Fail
          10 ea b36 - Fail
          Show
          fmatte Fairoz Matte added a comment - This issue is reproducible in all the versions of 8 9 and 10 Below is the results on 10 ea b36 == -sh-4.2$ /scratch/fairoz/JAVA/jdk10/jdk-10-ea+36/bin/javac -Xdoclint:all -Werror MyClass.java MyClass.java:14: warning: no comment      static final Function<String, String> someFunction = string -> {                                                           ^ MyClass.java:16: warning: no comment         int localVariable = 3;             ^ error: warnings found and -Werror specified 1 error 2 warnings 8 GA - Fail 9 GA - Fail 9.0.1 GA - Fail 10 ea b36 - Fail
          Hide
          jjg Jonathan Gibbons added a comment -
          Test case confirmed.
          Show
          jjg Jonathan Gibbons added a comment - Test case confirmed.
          Hide
          jjg Jonathan Gibbons added a comment -
          Problem is in DocLint.DeclScanner ... it should ignore lambda expressions
          Show
          jjg Jonathan Gibbons added a comment - Problem is in DocLint.DeclScanner ... it should ignore lambda expressions
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk/jdk10/rev/9c37fbceb579
          User: jjg
          Date: 2018-01-04 21:00:11 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk/jdk10/rev/9c37fbceb579 User: jjg Date: 2018-01-04 21:00:11 +0000

            People

            • Assignee:
              jjg Jonathan Gibbons
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: