Javaparser: variable extraction

Created on 23 Apr 2020  路  3Comments  路  Source: javaparser/javaparser

when using VariableDeclarationExpr to get variable of a class , For ex:

Class A{

public void test(){

String s = "a";
if(x==y)
s = "test"
}
I am getting only one instance i.e s = "a" , is it an issue , or it was the expected behaviour.

Question (AST)

All 3 comments

In your sample, it's the only variable declaration.

yes, the second one
s=test
is an AssignmentExpr

I am able to get using AssignmentExpr. Thank you.

Was this page helpful?
0 / 5 - 0 ratings