I've been implementing a Java parser with JDT and I can't figure out how to get a variable type when its node's type is VariableDeclarationFragment.
I found out how to get a variable type only when it comes to VariableDeclaration
My code is the following.
public boolean visit(VariableDeclarationFragment node) {
SimpleName name = node.getName();
System.out.println("Declaration of '" + name + "' of type '??');
return false; // do not continue
}
Can anyone help me?
I just figured out how to get the type from VariableDeclarationFragment. I just have to get its parent, which is a FieldDeclaration, then I can access its variable type.