RFR: JDK-8181854: NullPointerException in com.sun.tools.javac.api.JavacTrees.getElement

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Aug 17 15:15:59 UTC 2018


Jan,

Ideally, javadoc (i.e. the doctree API) should handle generic types.  As 
a partial solution, is it worth detecting, and ignoring '<...>' so that 
we treat 'List<E>' as 'List'.

-- Jon


On 8/17/18 6:25 AM, Jan Lahoda wrote:
> Hi,
>
> The problem described in this bug is that when the source code 
> contains javadoc reference like:
> {@link List<E> ...}
> (which is not valid), calling DocTrees.getElement(DocTreePath) for the 
> reference leads to a NPE. The reason is that internally, the method 
> will call Attr.attribIdent for an AST that corresponds to "List<E>", 
> but attribIdent can only handle identifiers and member selects. The 
> proposed solution is to avoid calling attribIdent if the AST node is 
> not an identifier or member select.
>
> Webrev: http://cr.openjdk.java.net/~jlahoda/8181854/webrev.00/
> JBS: https://bugs.openjdk.java.net/browse/JDK-8181854
>
> Any feedback is welcome.
>
> Thanks,
>    Jan



More information about the compiler-dev mailing list