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

Incomplete type hierarchy when using method reference

Open
#830 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=560545

To reproduce, compute the type hierarchy of `TestInterface` in the following snippet:

```
public class TestClass {

interface TestInterface {
void testMethod();
}

public TestInterface ti1 = TestClass.this::testMethod;
public TestInterface ti2 = () -> testMethod();
public TestInterface ti3 = new TestInterface() {
public void testMethod() {
TestClass.this.testMethod();
}
};

public void testMethod() {
System.out.println("TestClass.testMethod()");
}

public static void main(String[] args) {
TestClass t = new TestClass();
t.ti1.testMethod();
t.ti2.testMethod();
t.ti3.testMethod();
}
}
```

Observe that no implementer is found for the method reference. Only for the lambda and the anonymous type.

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.