ftomassetti / effectivejava

Run queries on your Java code to check if it meets the criteria suggested by the book Effective Java. And some others.
Apache License 2.0
506 stars 45 forks source link

UnsolvedSymbolException while trying to ResolvedMethodDeclaration from MethodCallExpr #76

Closed SunilDC closed 4 years ago

SunilDC commented 4 years ago

Hello,

I am trying to fetch method callers. In that i have a case with method overloaded. I need to check the arguments type to identify the respective methods. So i am calling resolve() method from MethodCallExpr. I am facing UnsolvedSymbolException while executing resolve() method. Please find the below code snap. Please help me to solve the issue.

**JavaParser Configuration:

CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver(); combinedTypeSolver.add(new ReflectionTypeSolver()); JavaSymbolSolver symbolSolver = new JavaSymbolSolver(combinedTypeSolver); StaticJavaParser.getConfiguration().setSymbolResolver(symbolSolver); CompilationUnit parsingResult = StaticJavaParser.parse(filePath);

Exception @ below line:

ResolvedMethodDeclaration resolve = mCallExp.resolve();**

Thank you.

ftomassetti commented 4 years ago

I think you should ask about this in the JavaParser project. Wrong project, closing