Bug 128389

Summary: [compiler][1.5] generic inner type cannot extend Throwable
Product: [Eclipse Project] JDT Reporter: Maxime Daniel <maxime_daniel>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Maxime Daniel CLA 2006-02-17 07:26:10 EST
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.
Comment 1 Maxime Daniel CLA 2006-02-17 12:28:32 EST
Released test as GenericTypeTest#_test915 (conflict during merge).
Comment 2 Philipe Mulet CLA 2006-02-17 13:00:45 EST
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.
Comment 3 David Audel CLA 2006-03-27 08:56:46 EST
Verified for 3.2 M6 using build I20060327-0010