Skip to content

Commit

Permalink
Merge pull request #22 from Saxonica/show-nested
Browse files Browse the repository at this point in the history
Show nested classes and interfaces
  • Loading branch information
ndw authored Oct 4, 2024
2 parents bf7e63c + 62cf0d8 commit 226f7b4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
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

0 comments on commit 226f7b4

Please sign in to comment.