| Summary: | "Cannot infer type arguments" with nested ternary | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Chris Cooper <chris.cooper> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.5.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Compiles fine using JDK 1.8 but Eclipse (4.5, 4.5.1) reports the following as an error: //--- import java.util.function.Function; public class TestInference { private static class Foo<T> { public Foo(Function<Void, T> func) { } } public static void main(String[] args) { // Compiler error "Cannot infer type arguments for Foo<>" Foo<String> foo = new Foo<>(t -> { return Math.random() < 0.5 ? "first" : Math.random() < 0.5 ? "second" : "third"; }); // Works fine Foo<String> foo2 = new Foo<>(t -> { return "string"; }); } } //--- Looks like quite a few possibly related bugs so this might already be fixed in a later build I guess?