JavaParser SymbolSolver and JGit to find method qualified name for a given commit

93 views Asked by At

Consider the following code:

mt.resolve().getQualifiedSignature();

Here mt is of type MethodDeclaration, and it might come from a MethodCallExpr.

Now in order it to work accurately, I need to set the following:

CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver();

combinedTypeSolver.add(new ReflectionTypeSolver());

combinedTypeSolver.add(new JavaParserTypeSolver(new File("src/java1/")));

combinedTypeSolver.add(new JavaParserTypeSolver(new File("src/java2/ ")));

This is easy, except I have two issues considering my scenario.

1) I can not set the root source directories manually. I need to find them automatically.

2) I can not give path like the above, because I am using jGit to checkout to different commits. So the paths are not fixed and might vary based on the different checkout commits. So the path should be accessed using JGit tree.

Any help would be highly appreciated.

0

There are 0 answers