eclipse-jdt / eclipse-jdt/eclipse.jdt.core
DOM Bindings not resolving to IMethod for some case of generics
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
In some cases, the DOM Bindings fails to resolve a MethodBinding to an IJavaElement (ISourceMethod precisely in this case).
To reproduce, hook this in ResolveTests_1_5, and see it fails because the IJavaElement in `null`.
```java
public void test0022_ASTParser() throws JavaModelException {
ICompilationUnit cu = getCompilationUnit("Resolve", "src2", "test0022", "Test.java");
String str = cu.getSource();
String selection = "add";
int start = str.lastIndexOf(selection);
int length = selection.length();
ASTParser parser = ASTParser.newParser(AST.getJLSLatest());
parser.setResolveBindings(true);
parser.setSource(cu);
ASTNode node = parser.createAST(null);
Name name = (Name)NodeFinder.perform(node, start, length);
assertTrue(name.resolveBinding().getJavaElement() instanceof ISourceMethod);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.