Community
Participate
Working Groups
I20060215-0010 (aka almost 3.2 M5) On the following code, the compiler fails to complain that since Y is a generic type, it cannot extend Throwable: public class X<T> { class Y extends Throwable { private static final long serialVersionUID = 1L; T t; } } See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5086027, which states that javac fails as well. Note that adding a supplementary type parameter to Y yields the expected error. Prepared GenericTypeTest#test910 for inclusion.
Released test as GenericTypeTest#_test915 (conflict during merge).
Indeed, being nested inside a generic should also fail. Note that static member of generic types should remain eligible for being an exception (Y2): public class X<T> { class Y1 extends Throwable { private static final long serialVersionUID = 1L; T t; } static class Y2 extends Throwable { private static final long serialVersionUID = 1L; } class Y3<U> extends Throwable { private static final long serialVersionUID = 1L; T t; } } class Y4<E> extends Throwable {} Tuned and enabled GenericTypeTest#test915.
Verified for 3.2 M6 using build I20060327-0010