Bug 259633

Summary: [1.5][compiler] Bound of type parameter of class in method not checked
Product: [Eclipse Project] JDT Reporter: Wouter Coekaerts <wouter>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_audel
Version: 3.4.1   
Target Milestone: 3.5 M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch and testcase none

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