eclipse-jdt / eclipse-jdt/eclipse.jdt.core

DOM Bindings not resolving to IMethod for some case of generics

Open
#2,312 1 comment 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.