Apache Lucene open-source search software
fix missing javadocs checker to work with Java 1.8 generated javadocs too
Michael McCandless68b6d00cba7e
diff --git a/dev-tools/scripts/checkJavaDocs.py b/dev-tools/scripts/checkJavaDocs.pyindex 4c36809e4cc..e7b13eb09ab 100644--- a/dev-tools/scripts/checkJavaDocs.py+++ b/dev-tools/scripts/checkJavaDocs.py@@ -22,9 +22,11 @@ reHREF = re.compile('<a.*?>(.*?)</a>', re.IGNORECASE)reMarkup = re.compile('<.*?>')reDivBlock = re.compile('<div class="block">(.*?)</div>', re.IGNORECASE)reCaption = re.compile('<caption><span>(.*?)</span>', re.IGNORECASE)+reJ8Caption = re.compile('<h3>(.*?) Summary</h3>')reTDLastNested = re.compile('^<td class="colLast"><code><strong><a href="[^>]*\.([^>]*?)\.html" title="class in[^>]*">', re.IGNORECASE)reTDLast = re.compile('^<td class="colLast"><code><strong><a href="[^>]*#([^>]*?)">', re.IGNORECASE)reColOne = re.compile('^<td class="colOne"><code><strong><a href="[^>]*#([^>]*?)">', re.IGNORECASE)+reMemberNameLink = re.compile('^<td class="colLast"><code><span class="memberNameLink"><a href="[^>]*#([^>]*?)">', re.IGNORECASE)# the Method detail section at the endreMethodDetail = re.compile('^<h3>Method Detail</h3>$', re.IGNORECASE)@@ -146,6 +148,7 @@ def checkClassDetails(fullPath):return Falsedef checkClassSummaries(fullPath):+ #print("check %s" % fullPath)# TODO: only works with java7 generated javadocs now!f = open(fullPath, encoding='UTF-8')@@ -167,6 +170,7 @@ def checkClassSummaries(fullPath):lineCount += 1if m is not None:foundMethodDetail = True+ #print(' got method detail')continue# prune methods that are just @Overrides of other interface/classes,@@ -177,8 +181,9 @@ def checkClassSummaries(fullPath):if m is not None:lastMethodAnchor = m.group(1)continue- m = reMethodOverridden.search(line)- if m is not None and ('Methods', lastMethodAnchor) in missing:+ isOverrides = '>Overrides:<' in line or '>Specified by:<' in line+ #print('check for removing @overridden method: %s; %s; %s' % (lastMethodAnchor, isOverrides, missing))+ if isOverrides and ('Methods', lastMethodAnchor) in missing:#print('removing @overridden method: %s' % lastMethodAnchor)missing.remove(('Methods', lastMethodAnchor))@@ -186,36 +191,40 @@ def checkClassSummaries(fullPath):if m is not None:lastCaption = m.group(1)#print(' caption %s' % lastCaption)- m = reTDLastNested.search(line)- if m is not None:- # nested classes- lastItem = m.group(1)- #print(' item %s' % lastItem)else:- m = reTDLast.search(line)+ m = reJ8Caption.search(line)+ if m is not None:+ lastCaption = m.group(1)+ if not lastCaption.endswith('s'):+ lastCaption += 's'+ #print(' caption %s' % lastCaption)++ # Try to find the item in question (method/member name):+ for matcher in (reTDLastNested, # nested classes+ reTDLast, # methods etc.+ reColOne, # ctors etc.+ reMemberNameLink): # java 8+ m = matcher.search(line)if m is not None:- # methods etclastItem = m.group(1)- else:- # ctors etc- m = reColOne.search(line)- if m is not None:- lastItem = m.group(1)- #print(' item %s' % lastItem)+ #print(' found item %s; inThing=%s' % (lastItem, inThing))+ breaklineLower = line.strip().lower()- if lineLower.find('<tr class="') != -1:+ if lineLower.find('<tr class="') != -1 or lineLower.find('<tr id="') != -1:inThing = TruehasDesc = Falsecontinueif inThing:if lineLower.find('</tr>') != -1:+ #print(' end item %s; hasDesc %s' % (lastItem, hasDesc))if not hasDesc:if lastItem is None:raise RuntimeError('failed to locate javadoc item in %s, line %d? last line: %s' % (fullPath, lineCount, line.rstrip()))missing.append((lastCaption, unEscapeURL(lastItem)))+ #print(' add missing; now %d: %s' % (len(missing), str(missing)))inThing = Falsecontinueelse:@@ -236,6 +245,7 @@ def checkClassSummaries(fullPath):desc = desc.replace('</div>', '')desc = desc.strip()hasDesc = len(desc) > 0+ #print(' thing %s: %s' % (lastItem, desc))desc = Nonef.close()diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.javaindex 2d2d6029410..8919acfaa73 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java@@ -117,7 +117,8 @@ import org.apache.lucene.util.fst.Util.TopResults;** @lucene.experimental*/-public class AnalyzingSuggester extends Lookup {+// redundant 'implements Accountable' to workaround javadocs bugs+public class AnalyzingSuggester extends Lookup implements Accountable {/*** FST<Weight,Surface>:diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.javaindex 66b2ffd5583..5813fd95c7e 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java@@ -110,7 +110,8 @@ import org.apache.lucene.util.fst.Util.TopResults;** @lucene.experimental*/-public class FreeTextSuggester extends Lookup {+// redundant 'implements Accountable' to workaround javadocs bugs+public class FreeTextSuggester extends Lookup implements Accountable {/** Codec name used in the header for the saved model. */public final static String CODEC_NAME = "freetextsuggest";diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.javaindex 33ceb6a074f..2edb79bbffa 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java@@ -60,7 +60,8 @@ import org.apache.lucene.util.fst.Util.TopResults;** @lucene.experimental*/-public class WFSTCompletionLookup extends Lookup {+// redundant 'implements Accountable' to workaround javadocs bugs+public class WFSTCompletionLookup extends Lookup implements Accountable {/*** FST<Long>, weights are encoded as costs: (Integer.MAX_VALUE-weight)