eclipse-jdt / eclipse-jdt/eclipse.jdt.core
The method run(Supplier<String[]>) is ambiguous for the type TestJ ava(67108966)
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
The following code produces an `The method run(Supplier) is ambiguous for the type TestJ ava(67108966)`, This code compiles fine with javac.
```java
import java.util.function.Supplier;
public class Test {
private Processor processor1;
private Processor processor2;
public String[] processors1() {
// An error will be reported here.
return run(processor1::processors);
}
public String[] processors2() {
// With the same code, since the processor2 field declares a generic type, no error will be reported here.
return run(processor2::processors);
}
private T run(Supplier supplier) {
return supplier.get();
}
private void run(Runnable task) {
}
public static abstract class Processor {
public String[] processors() {
return new String[0];
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.