-
Bug
-
Resolution: Unresolved
-
P4
-
8u60
-
None
This began failing with the patch from JDK-8069545.
---
class C<T> {}
<S> C<S> makeC(Function<String,S> f) { return null; }
<T extends Comparable<T>> void eatC(C<T> list) {}
void test() {
eatC(makeC(x->x));
}
---
Expected: compiles, S = T = String
Actual: error:
error: method eatC cannot be applied to given types;
eatC(makeC(x->x));
^
required: C<T>
found: C<Object>
reason: inferred type does not conform to upper bound(s)
inferred: Object
upper bound(s): Comparable<Object>,Object
---
class C<T> {}
<S> C<S> makeC(Function<String,S> f) { return null; }
<T extends Comparable<T>> void eatC(C<T> list) {}
void test() {
eatC(makeC(x->x));
}
---
Expected: compiles, S = T = String
Actual: error:
error: method eatC cannot be applied to given types;
eatC(makeC(x->x));
^
required: C<T>
found: C<Object>
reason: inferred type does not conform to upper bound(s)
inferred: Object
upper bound(s): Comparable<Object>,Object
- relates to
-
JDK-8146362 Type inference fails with Function.identity() as params
-
- Open
-
-
JDK-8069545 javac, shouldn't check nested stuck lambdas during overload resolution
-
- Closed
-