Bug 128389 - [compiler][1.5] generic inner type cannot extend Throwable
Summary: [compiler][1.5] generic inner type cannot extend Throwable
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-17 07:26 EST by Maxime Daniel CLA
Modified: 2006-03-27 08:56 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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