How can I determine type of Groovy
variable using Java
?
For example we have the next Groovy
code:
a = new Integer(4);
b = a + 1;
a = "b = " + b;
How can we programatically analyze it and determine that type of a
variable at b = a + 1;
line is java.lang.Integer
?
As a
is dynamic variable we can't get its type from Groovy AST
, because AST
doesn't contain such info.
- update: added more details
- update: clarified question