-
Bug
-
Resolution: Unresolved
-
P4
-
8u60, 9
This fails with a compiler error:
<S> Iterable<S> id(Iterable<S> arg) { return arg; }
<T extends Comparable<T>> Iterable<T> empty() { return null; }
void test() { id(empty()); }
So does this:
<S extends Comparable<S>> Iterable<S> id(Iterable<S> arg) { return arg; }
<T> Iterable<T> empty() { return null; }
void test() { id(empty()); }
This succeeds:
<T extends Comparable<T>> Iterable<T> empty() { return null; }
void test() { empty(); }
All ought to succeed (per JLS 18.4), generating a type variable of the form:
Z extends Comparable<Z>
<S> Iterable<S> id(Iterable<S> arg) { return arg; }
<T extends Comparable<T>> Iterable<T> empty() { return null; }
void test() { id(empty()); }
So does this:
<S extends Comparable<S>> Iterable<S> id(Iterable<S> arg) { return arg; }
<T> Iterable<T> empty() { return null; }
void test() { id(empty()); }
This succeeds:
<T extends Comparable<T>> Iterable<T> empty() { return null; }
void test() { empty(); }
All ought to succeed (per JLS 18.4), generating a type variable of the form:
Z extends Comparable<Z>