Bug 235837 - [1.5][compiler] disallow upcast of implicit generic type
Summary: [1.5][compiler] disallow upcast of implicit generic type
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL: http://forum.java.sun.com/thread.jspa...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-05 10:51 EDT by Hollis Waite CLA
Modified: 2008-06-09 04:47 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 Hollis Waite CLA 2008-06-05 10:51:11 EDT
Build ID: M20070921-1145

Steps To Reproduce:
class Test {
  void bar() {
    Integer i = 0;
    Double d = 0.0;
    foo((Collection<Number>) Arrays.asList(i, d));
  }
  void foo(Collection<Number> c) {}
}

More information:
The code is fails to compile in JDK 1.6.06 but succeeds in Eclipse.
Comment 1 Philipe Mulet CLA 2008-06-05 12:49:13 EDT
Cast semantics got tightened during 3.4 cycle.
This issue is now resolved.

Closing as worksforme
Comment 2 Philipe Mulet CLA 2008-06-05 12:51:04 EDT
Added GenericTypeTest#test1340
Comment 3 Philipe Mulet CLA 2008-06-05 12:53:44 EDT
We now report: "Cannot cast from List<Number&Comparable<?>> to Collection<Number>"
Comment 4 Frederic Fusier CLA 2008-06-06 09:08:42 EDT
Verified for 3.4RC4 using I20080606-0100
Comment 5 Philipe Mulet CLA 2008-06-09 04:47:36 EDT
Regression test is actually GenericTypeTest#test1341