You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2020/09/01 17:24:19 UTC

[lucene-solr] branch LUCENE-9215 updated: LUCENE-9215: log errors about missing @param even when tree is null

This is an automated email from the ASF dual-hosted git repository.

rmuir pushed a commit to branch LUCENE-9215
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/LUCENE-9215 by this push:
     new 2a7055c  LUCENE-9215: log errors about missing @param even when tree is null
2a7055c is described below

commit 2a7055c80cc1ee9da7c2f78deec6d85270e7e23f
Author: Robert Muir <rm...@apache.org>
AuthorDate: Tue Sep 1 13:24:16 2020 -0400

    LUCENE-9215: log errors about missing @param even when tree is null
    
    This means on the first run, you'll see everything you need to fix (up to javadoc's limit)
    
    Instead of:
    
    > Task :lucene:memory:renderJavadoc FAILED
    /home/rmuir/workspace/lucene-solr/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java:283: error - MemoryIndex.fromDocument (method): javadocs are missing
    1 error
    
    You now see:
    
    > Task :lucene:memory:renderJavadoc FAILED
    /home/rmuir/workspace/lucene-solr/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java:283: error - MemoryIndex.fromDocument (method): javadocs are missing
    /home/rmuir/workspace/lucene-solr/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java:283: error - MemoryIndex.fromDocument (method): missing javadoc @param for parameter 'document'
    /home/rmuir/workspace/lucene-solr/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java:283: error - MemoryIndex.fromDocument (method): missing javadoc @param for parameter 'analyzer'
    3 errors
    
    Previously the tooling would force you to do a second pass.
---
 .../java/org/apache/lucene/missingdoclet/MissingDoclet.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dev-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java b/dev-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java
index 6253602..89c205f 100644
--- a/dev-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java
+++ b/dev-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java
@@ -319,7 +319,7 @@ public class MissingDoclet extends StandardDoclet {
         error(element, "comment is really a license");
       }
     }
-    if (level >= PARAMETER && tree != null) {
+    if (level >= PARAMETER) {
       checkParameters(element, tree);
     }
   }
@@ -385,10 +385,12 @@ public class MissingDoclet extends StandardDoclet {
     if (element instanceof ExecutableElement) {
       // record each @param that we see
       Set<String> seenParameters = new HashSet<>();
-      for (var tag : tree.getBlockTags()) {
-        if (tag instanceof ParamTree) {
-          var name = ((ParamTree)tag).getName().getName().toString();
-          seenParameters.add(name);
+      if (tree != null) {
+        for (var tag : tree.getBlockTags()) {
+          if (tag instanceof ParamTree) {
+            var name = ((ParamTree)tag).getName().getName().toString();
+            seenParameters.add(name);
+          }
         }
       }
       // now compare the method's formal parameter list against it