Bug 104649 - [1.5][compiler] method type variable: inference broken for null
Summary: [1.5][compiler] method type variable: inference broken for null
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.1.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-21 09:34 EDT by Markus Keller CLA
Modified: 2005-09-26 11:46 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-07-21 09:34:02 EDT
N20050721-0010

public class Try {
	void shouldcompile() {
		java.util.Collections.max(null);
	}
}

The eclipse compiler rejects with error:
"Bound mismatch: The generic method max(Collection<? extends T>) of type
Collections is not applicable for the arguments (Collection<? extends
Comparable<? super T>>) since the type Comparable<? super T> is not a valid
substitute for the bounded parameter <T extends Object & Comparable<? super T>>"

javac bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6299211
Comment 1 Philipe Mulet CLA 2005-07-23 19:51:37 EDT
Tuned bound check after inference. Problem came from the fact T got inferred to
Comparable<? super T> by default (since didn't get inferred from 'null' argument
but rather using formal bound); which got substituted before performing bound
check (and thus got compared to:  Comparable<? super Comparable<? super T>>

Fixed. Added GenericTypeTest#test792
Comment 2 Olivier Thomann CLA 2005-08-09 11:47:19 EDT
Verified for 3.2M1 (I20050808-2000)
Comment 3 David Audel CLA 2005-09-26 11:46:44 EDT
Verified using M20050923-1430 for 3.1.1