Bug 203318

Summary: [1.5][compiler] Improper capture of wildcard with lesser bound than parameter
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_audel, jerome_lanneluc
Version: 3.4Flags: philippe_mulet: pmc_approved+
Target Milestone: 3.3.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 202404    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch none

Description Philipe Mulet CLA 2007-09-13 13:06:36 EDT
Build 3.4m1

The following code should compile clean:

class X<T extends Number> {
	T get() {	return null; };
    void foo(X<? extends Object> x) {
		x.get().intValue();    	
    }
}

but currently, #intValue() is not found since the capture superclass is considered to be Object instead of Number.
Comment 1 Philipe Mulet CLA 2007-09-13 13:07:57 EDT
Created attachment 78347 [details]
Proposed patch
Comment 2 Philipe Mulet CLA 2007-09-13 13:10:57 EDT
This fix first requires addressing bug 202404 first.
Comment 3 Philipe Mulet CLA 2007-09-13 18:27:46 EDT
Added GenericTypeTest#test1165
Released for 3.4M2
Fixed
Comment 4 David Audel CLA 2007-09-18 06:30:35 EDT
Verified for 3.4M2 using build I20070918-0010
Comment 5 Philipe Mulet CLA 2007-10-10 04:26:20 EDT
considering for 3.3.2
Comment 6 Philipe Mulet CLA 2007-10-10 04:26:53 EDT
Released for 3.3.2
Fixed
Comment 7 Maxime Daniel CLA 2007-10-29 12:44:45 EDT
Only adding Verified for 3.4M2 to the status whiteboard, since I believe this
got lost.
Comment 8 Jerome Lanneluc CLA 2007-11-22 10:17:45 EST
The compiler semantics near capture conversion need to be tuned to match the spec. Without these changes, we see quite many corner cases failing to compile properly or being rejected incorrectly, and numerous customers starting to notice it.
Comment 9 Philipe Mulet CLA 2007-11-23 09:18:59 EST
+1 for 3.3.2
Comment 10 David Audel CLA 2008-01-24 04:35:56 EST
Verified for 3.3.2 using build M20080123-0800