Bug 97800

Summary: [1.5][compiler] Cast type shouldn't be used in generic method argument inference
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: thanson
Version: 3.1   
Target Milestone: 3.1 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philipe Mulet CLA 2005-06-01 03:58:24 EDT
3.1rc1

This should fail:

import java.util.*;
public class Y {
		 public static void main(String[] args) {
		 		 List<String> l = (List<String>)Collections.emptyList();
		 }
		 
}

Generic method invocation only looks at the expected type when in the context of
Assignment Conversion, not Casting Conversion.
Comment 1 Philipe Mulet CLA 2005-06-01 03:59:31 EDT
Credits for finding this defect go to Tim Hanson.
Comment 2 Philipe Mulet CLA 2005-06-01 04:28:17 EDT
Added GenericTypeTest#test704. Impacted other existing tests (171&396).
Fix is to stop setting expected type in CastExpressions.

Fixed
Comment 3 Frederic Fusier CLA 2005-06-07 11:09:47 EDT
Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD
Comment 4 David Audel CLA 2005-06-10 12:01:39 EDT
Verified for 3.1 RC2 using build I20050610-0010