You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when solve MethodCallExpra.a(b.b()), throws exception:
Unsolvedsymbol : Weareunabletofindthemethoddeclarationcorrespondingtoa.a(b.b())
UnsolvedSymbolException{context='null', name='We are unable to find the method declaration corresponding to a.a(b.b())', cause='null'}
atcom.github.javaparser.symbolsolver.JavaSymbolSolver.resolveDeclaration(JavaSymbolSolver.java:167)
atcom.github.javaparser.ast.expr.MethodCallExpr.resolve(MethodCallExpr.java:313)
...
Code to reproduce:
@TestpublicvoidtestIt() {
ParserConfigurationconfig = newParserConfiguration();
CombinedTypeSolvertypeResolver = newCombinedTypeSolver(newReflectionTypeSolver(false));
typeResolver.add(newJavaParserTypeSolver("src/test/resources/issue2960"));
config.setSymbolResolver(newJavaSymbolSolver(typeResolver));
StaticJavaParser.setConfiguration(config);
Stringcode = "package foo;\n"
+ "import foo.A;\n"
+ "import foo.B;\n"
+ "public class Test {\n"
+ " public void foo() {\n"
+ " A a = new A();\n"
+ " B b = new B();\n"
+ " a.a(b.b());\n"
+ " }\n"
+ "}";
CompilationUnitcu = StaticJavaParser.parse(code);
for (MethodCallExprmethodCallExpr : cu.findAll(MethodCallExpr.class)) {
if (methodCallExpr.getNameAsString().equals("a")) {
methodCallExpr.resolve();
}
}
}
The text was updated successfully, but these errors were encountered:
Parsing the following code:
while
A
andB
is defined:when solve
MethodCallExpr
a.a(b.b())
, throws exception:Code to reproduce:
The text was updated successfully, but these errors were encountered: