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

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


Hi

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?

Mayuresh.



More information about the compiler-dev mailing list