handle default annotations; remove workaround for now fixed javadoc bug

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1654004 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-01-22 18:53:21 +00:00
parent 08dee02f04
commit 3941b3f266
1 changed files with 8 additions and 9 deletions

View File

@ -80,8 +80,6 @@ def checkClassDetails(fullPath):
Checks for invalid HTML in the full javadocs under each field/method. Checks for invalid HTML in the full javadocs under each field/method.
""" """
isAttributeSource = fullPath.endswith('AttributeSource.html')
# TODO: only works with java7 generated javadocs now! # TODO: only works with java7 generated javadocs now!
with open(fullPath, encoding='UTF-8') as f: with open(fullPath, encoding='UTF-8') as f:
desc = None desc = None
@ -90,15 +88,9 @@ def checkClassDetails(fullPath):
errors = [] errors = []
for line in f.readlines(): for line in f.readlines():
if isAttributeSource:
# Work around Javadocs bug that fails to escape the <T> type parameter in {@link #getAttribute} and {@link #addAttribute}
line = line.replace('<code>getAttribute(java.lang.Class<T>)</code>', '<code>getAttribute(java.lang.Class)</code>')
line = line.replace('<code>addAttribute(java.lang.Class<T>)</code>', '<code>addAttribute(java.lang.Class)</code>')
m = reH3.search(line) m = reH3.search(line)
if m is not None: if m is not None:
if desc is not None: if desc is not None:
# Have to fake <ul> context because we pulled a fragment out "across" two <ul>s:
desc = ''.join(desc) desc = ''.join(desc)
if True or cat == 'Constructor Detail': if True or cat == 'Constructor Detail':
idx = desc.find('</div>') idx = desc.find('</div>')
@ -108,6 +100,7 @@ def checkClassDetails(fullPath):
continue continue
desc = desc[:idx+6] desc = desc[:idx+6]
else: else:
# Have to fake <ul> context because we pulled a fragment out "across" two <ul>s:
desc = '<ul>%s</ul>' % ''.join(desc) desc = '<ul>%s</ul>' % ''.join(desc)
#print(' VERIFY %s: %s: %s' % (cat, item, desc)) #print(' VERIFY %s: %s: %s' % (cat, item, desc))
try: try:
@ -123,6 +116,12 @@ def checkClassDetails(fullPath):
if m is not None: if m is not None:
if desc is not None: if desc is not None:
# Have to fake <ul> context because we pulled a fragment out "across" two <ul>s: # Have to fake <ul> context because we pulled a fragment out "across" two <ul>s:
if cat == 'Element Detail':
desc = ''.join(desc)
idx = desc.find('</dl>')
if idx != -1:
desc = desc[:idx+5]
else:
desc = '<ul>%s</ul>' % ''.join(desc) desc = '<ul>%s</ul>' % ''.join(desc)
#print(' VERIFY %s: %s: %s' % (cat, item, desc)) #print(' VERIFY %s: %s: %s' % (cat, item, desc))
try: try: