mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
GT-2707: Adding in interfaces and package-level stuff to jsondocs.
This commit is contained in:
parent
9ba25cb99c
commit
02df1b134c
@ -39,8 +39,6 @@ import jdk.javadoc.doclet.*;
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class JsonDoclet implements Doclet {
|
public class JsonDoclet implements Doclet {
|
||||||
|
|
||||||
private final Set<Modifier> ACCESS_LEVEL = Set.of(Modifier.PUBLIC);
|
|
||||||
|
|
||||||
private Reporter log;
|
private Reporter log;
|
||||||
private File destDir;
|
private File destDir;
|
||||||
|
|
||||||
@ -122,8 +120,7 @@ public class JsonDoclet implements Doclet {
|
|||||||
//@formatter:off
|
//@formatter:off
|
||||||
ElementFilter.typesIn(docEnv.getIncludedElements())
|
ElementFilter.typesIn(docEnv.getIncludedElements())
|
||||||
.stream()
|
.stream()
|
||||||
.filter(el -> el.getModifiers().containsAll(ACCESS_LEVEL))
|
.filter(el -> el.getKind().equals(ElementKind.CLASS) || el.getKind().equals(ElementKind.INTERFACE))
|
||||||
.filter(el -> el.getKind().equals(ElementKind.CLASS))
|
|
||||||
.forEach(el -> writeJsonToFile(classToJson(el), el.getQualifiedName()));
|
.forEach(el -> writeJsonToFile(classToJson(el), el.getQualifiedName()));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
@ -211,9 +208,6 @@ public class JsonDoclet implements Doclet {
|
|||||||
JSONArray methodArray = new JSONArray();
|
JSONArray methodArray = new JSONArray();
|
||||||
|
|
||||||
for (Element el : classElement.getEnclosedElements()) {
|
for (Element el : classElement.getEnclosedElements()) {
|
||||||
if (!el.getModifiers().containsAll(ACCESS_LEVEL)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("name", el.getSimpleName().toString());
|
obj.put("name", el.getSimpleName().toString());
|
||||||
|
@ -134,6 +134,10 @@ task createJsondocs(type: Javadoc, description: 'Generate JSON docs for all proj
|
|||||||
it.sourceSets.test.compileClasspath
|
it.sourceSets.test.compileClasspath
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Generate at package level because user may try to get help directly on an object they have
|
||||||
|
// rather than its public interface.
|
||||||
|
options.addBooleanOption("package", true)
|
||||||
|
|
||||||
// Some internal packages are not public and need to be exported.
|
// Some internal packages are not public and need to be exported.
|
||||||
options.addMultilineStringsOption("-add-exports").setValue(["java.desktop/sun.awt.image=ALL-UNNAMED",
|
options.addMultilineStringsOption("-add-exports").setValue(["java.desktop/sun.awt.image=ALL-UNNAMED",
|
||||||
"java.desktop/sun.awt=ALL-UNNAMED",
|
"java.desktop/sun.awt=ALL-UNNAMED",
|
||||||
|
Loading…
Reference in New Issue
Block a user