lang tools : how to get "TypeElement" for a local variable

Mayuresh mayuresh at
Sun Nov 9 09:29:27 PST 2008


I was exploring the syntax tree exposed by Compiler API using TreePathScanner 
based visitor.

I am trying to get the "TypeElement" for a variable declaration to extract 
qualified type of the variable etc.

I am using Trees.getElement() to get the TypeElement to which I pass current 
path at a VariableTree node.

I can get the Element for member or method parameter declaration though for 
local variables Element returned is null.

Is this a bug? Is there some other way to get TypeElement?


More information about the compiler-dev mailing list