Warn when certain constructor is used

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu May 31 11:45:27 UTC 2018



On 31/05/18 12:21, Pietro Paolini wrote:
> JCTree tree = (JCTree) trees.getTree(element);
> tree.accept(new LocalDateUtilDate());
There re two visitor methods in JCTree, one internal (used by javac), 
one external (used by the API). I don't think you need to cast down to 
JCTree (yet, at least). Just keep it as a com.sun.source.tree.Tree, and 
you will see that the only 'accept' method there takes two arguments: a 
visitor (which you have) and a visitor parameter; since you don't seem 
to need a visitor parameter, you can just pass 'null' as second parameter.

Maurizio


More information about the compiler-dev mailing list