Bug 259633 - [1.5][compiler] Bound of type parameter of class in method not checked
Summary: [1.5][compiler] Bound of type parameter of class in method not checked
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-24 08:38 EST by Wouter Coekaerts CLA
Modified: 2009-01-27 06:57 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch and testcase (3.38 KB, patch)
2009-01-06 15:52 EST, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wouter Coekaerts CLA 2008-12-24 08:38:52 EST
Build ID: M20080911-1700

Steps To Reproduce:
Create a class inside a method with a type parameter with a bound. Create a subclass of this class, using a type parameter that does not extends the bound.
This code should not compile, but in Eclipse it does.
Example:
public class BoundNotChecked {
	public static void main(String... args) {
		class SuperclassZom<T extends Number> {
			public T t;
		}
		class Subclass extends SuperclassZom<String> {
		}
		
		new Subclass().t="test";
	}
}

Trying to run this code gives a java.lang.VerifyError



More information:
The bound is properly checked if the classes are just inner classes of the class; outside the method.
Comment 1 Kent Johnson CLA 2009-01-06 15:52:58 EST
Created attachment 121691 [details]
Proposed patch and testcase
Comment 2 Kent Johnson CLA 2009-01-07 12:29:07 EST
Fix and test released for 3.5M5
Comment 3 David Audel CLA 2009-01-27 06:57:13 EST
Verified for 3.5M5 using I20090126-1300