Summary
com.sun.source.util.DocTreeScanner#visitAttribute will scan over com.sun.source.doctree.AttributeNode#getValue(), and com.sun.source.util.DocTreeScanner#visitLiteral will scan over com.sun.source.doctree.LiteralNode#getBody().
Problem
The visit methods in tree scanners in com.sun.source.util (TreeScanner and DocTreeScanner) are generally expected to scan over all the subnodes of the given node. That is, however, not the case of com.sun.source.util.DocTreeScanner#visitAttribute and com.sun.source.util.DocTreeScanner#visitLiteral, which are not scanning through the children of the corresponding AttributeNode and LiteralNode.
Solution
Fix the DocTreeScanner to scan over the children of AttributeNode and LiteralNode.
Specification
The specific change is as follows:
diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java --- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java @@ -122,19 +122,19 @@ /* *************************************************************************** * Visitor methods ****************************************************************************/ /** - * {@inheritDoc} This implementation returns {@code null}. + * {@inheritDoc} This implementation scans the children in left to right order. * * @param node {@inheritDoc} * @param p {@inheritDoc} * @return the result of scanning */ @Override public R visitAttribute(AttributeTree node, P p) { - return null; + return scan(node.getValue(), p); } /** * {@inheritDoc} This implementation scans the children in left to right order. * @@ -309,19 +309,19 @@ r = scanAndReduce(node.getLabel(), p, r); return r; } /** - * {@inheritDoc} This implementation returns {@code null}. + * {@inheritDoc} This implementation scans the children in left to right order. * * @param node {@inheritDoc} * @param p {@inheritDoc} * @return the result of scanning */ @Override public R visitLiteral(LiteralTree node, P p) { - return null; + return scan(node.getBody(), p); } /** * {@inheritDoc} This implementation scans the children in left to right order. *
- csr of
-
JDK-8227922 DocTreeScanner does not dive into AttributeTree.getValue() and LiteralTree.getBody()
-
- Resolved
-