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

Show nested classes and interfaces #22

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ incomplete or incorrect, please [open an issue](https://github.com/Saxonica/xmld

## Change log

* **0.15.0** Show nested classes and interfaces

As a convenience, the list of `classref` and `interfaceref` elements in a package
now includes nested classes and interfaces.

* **0.14.0** Fixed package name

The package name was sometimes (e.g., in the superclass type)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docletVersion=0.14.0
docletVersion=0.15.0
schemaVersion=0.13.0
docletTitle=XmlDoclet
docletName=xmldoclet
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public void scan(DocTree tree) {
builder.processList("description", dcTree.getBody());
}

recursiveRefs(element);
builder.endElement("package");
}

public void recursiveRefs(Element element) {
for (Element child : element.getEnclosedElements()) {
switch (child.getKind()) {
case CLASS:
Expand All @@ -45,12 +50,15 @@ public void scan(DocTree tree) {
case ANNOTATION_TYPE:
TypeUtils.xmlType(builder, "annotationtyperef", child.asType());
break;
case FIELD:
case METHOD:
case CONSTRUCTOR:
break;
default:
System.err.println("Unexpected element in package: " + child);
break;
}
recursiveRefs(child);
}

builder.endElement("package");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private static void declaredType(XmlProcessor builder, String wrapper, DeclaredT
/**
* Find the element's package.
* <p>For nested classes, we may have to look up several times.</p>
* @param element The starting element
* @return the package name
*/
public static String getPackage(Element element) {
Expand All @@ -97,7 +98,7 @@ public static String getPackage(Element element) {

/**
* Find the name of this type; that's our ancestor names if this is a nested class.
* @param element The element
* @param element The starting Welement
* @return The type name
*/
public static String getType(Element element) {
Expand Down
Loading