-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix resolving overloaded method-references. #2662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Cheers @maartenc Could you take a look at this though, as the test included seems to pass with or without the included changes. Edit: and the test case from #2657 still fails: @Test
public void issue2657Test_StringValueOfInStream() {
String s =
"import java.util.HashSet;\n" +
"import java.util.Set;\n" +
"import java.util.stream.Collectors;\n" +
"\n" +
"public class StreamTest {\n" +
" \n" +
" public void streamTest () {\n" +
" Set<Integer> intSet = new HashSet<Integer>() {{\n" +
" add(1);\n" +
" add(2);\n" +
" }};\n" +
" Set <String> strings = intSet.stream().map(String::valueOf).collect(Collectors.toSet());\n" +
" }\n" +
"}";
TypeSolver typeSolver = new ReflectionTypeSolver();
StaticJavaParser.getConfiguration().setSymbolResolver(new JavaSymbolSolver(typeSolver));
CompilationUnit cu = StaticJavaParser.parse(s);
int errorCount = 0;
Set<MethodCallExpr> methodCallExpr = new HashSet<>(cu.findAll(MethodCallExpr.class));
for (MethodCallExpr expr : methodCallExpr) {
try {
ResolvedMethodDeclaration rd = expr.resolve();
System.out.println("\t Solved : " + rd.getQualifiedSignature());
} catch (UnsolvedSymbolException e) {
System.out.println("\t UNSOLVED: " + expr.toString());
e.printStackTrace();
errorCount++;
}
}
assertEquals(0, errorCount, "Expected zero UnsolvedSymbolException s");
} |
…rs and have an explicit assert (as opposed to exception / no exception)
sorry, you are right, made some stupid error while cleaning up my code, I've committed a fix Strange my testcase didn't fail though, perhaps we should check what is different with the one you provided. |
All good! 😆 I'll merge now as it otherwise seems good now that tests are passing :) |
👍 |
Fixes #2657.