Community
Participate
Working Groups
For multiple bounds, returns true if only one of the bounds is satisfied rather than requiring all of the bounds to be satisfied. The comment indicates that all of the bounds must be satisfied, and JLS3 15.12.2.7, p. 465 seems to indicate that as well.
I think we have another bug for this. Need to isolate a simple testcase.
I think I was relating to a different issue in comment 1. Pls provide a testcase for suspected issue. The following is correctly handled with 3.3M6: public class X<T extends Comparable<T> & Runnable> { public static void main(String[] args) { X<OnlyRunnable> x1 = null; // error X<OnlyComparable> x2 = null; // error X<ComparableRunnable> x3 = null; // ok } } abstract class OnlyRunnable implements Runnable {} abstract class OnlyComparable implements Comparable<OnlyComparable> {} abstract
Oops, testcase got truncated. public class X<T extends Comparable<T> & Runnable> { public static void main(String[] args) { X<OnlyRunnable> x1 = null; // error X<OnlyComparable> x2 = null; // error X<ComparableRunnable> x3 = null; // ok } } abstract class OnlyRunnable implements Runnable {} abstract class OnlyComparable implements Comparable<OnlyComparable> {} abstract class ComparableRunnable implements Comparable<ComparableRunnable>, Runnable {}
(In reply to comment #3) This test case above is also correctly handled with 3.2.0. It looks like the problem is just with the comment. x.boundCheck(y) apparently means y is compatible with x, in which case y must be compatible with at least one of the bounds of x, not with all of them as the comment states.
Yes, this is my opinion too. For wildcards, the check is easier, since it relies on the fact that no offending type could be built anyway (and fed to the wildcard).
Fixed offending comment. Added GenericTypeTest#test1119 proving that current behavior is enforced.
Created attachment 62376 [details] Proposed patch
Verified for 3.3M7 with I20070427-0010