Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support java-17 version of the javadoc for doc generator #3536

Draft
wants to merge 2 commits into
base: java-17
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions docs/src/main/groovy/Javadoc7Parser.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ class Javadoc7Parser {
String findJavadocDescription(String objectName, Class cls, String obj, Closure errorHandler) {
try {
def html = loadJavadocFile(cls)

def contentContainer = html.depthFirst().find {
it.name() == 'div' && it.@class == 'contentContainer'
it.name() == 'main' && it.@role == 'main'
}
def detailsEl = contentContainer.depthFirst().find {
it.name() == 'div' && it.@class == 'details'
it.name() == 'section' && it.@class == 'details'
}

def descDiv = detailsEl.depthFirst().find {

if (it.name() == "li") {
def h4 = it.h4
return h4.size() > 0 && !h4.text().isEmpty() && obj == h4.text()
def h3 = it.section.h3
return h3.size() > 0 && !h3.text().isEmpty() && obj == h3.text()
} else {
return false
}
}

def description = descDiv.breadthFirst().find {
return it.name() == 'div' && it.@class == 'block'
}

def firstDescriptionDiv = descDiv.div[0]
return DocsXmlSupport.toXmlString(firstDescriptionDiv)
return DocsXmlSupport.toXmlString(description)
} catch (Exception e) {
if (cls.getSuperclass() != null) {
try {
Expand All @@ -58,7 +58,7 @@ class Javadoc7Parser {
throw new IllegalArgumentException(errorHandler(obj, objectName))
}
} else {
throw new IllegalArgumentException(errorHandler(obj, objectName))
return ""
}
}
}
Expand All @@ -67,17 +67,19 @@ class Javadoc7Parser {
return "Unable to find javadoc for method '$method' in '$objectName'"
}


String findClassDescription(Class cls) {
def html = loadJavadocFile(cls)

def contentContainer = html.depthFirst().find {
it.name() == 'div' && it.@class == 'contentContainer'
it.name() == 'main' && it.@role == 'main'
}
def descriptionEl = contentContainer.depthFirst().find {
it.name() == 'div' && it.@class == 'description'
it.name() == 'section' && it.@class == 'class-description'
}
def result = contentContainer.depthFirst().find {
it.name() == 'div' && it.@class == 'block'
}
return DocsXmlSupport.toXmlString(descriptionEl.ul.li.div[0])
return DocsXmlSupport.toXmlString(result)
}
def xmlCache = [:]

Expand Down
Loading