Bug 97800 - [1.5][compiler] Cast type shouldn't be used in generic method argument inference
Summary: [1.5][compiler] Cast type shouldn't be used in generic method argument inference
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-01 03:58 EDT by Philipe Mulet CLA
Modified: 2005-06-10 12:01 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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