Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 272783

Summary: [1.5][compiler] Eclipse accepts invalid generic code
Product: [Eclipse Project] JDT Reporter: Hollis Waite <hwaite>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, philippe_mulet
Version: 3.4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Hollis Waite CLA 2009-04-18 01:49:54 EDT
Build ID: M20090211-1700

Steps To Reproduce:
import java.util.Arrays;
import java.util.Collections;
public class Test {
 Iterable<Object> x = Collections.unmodifiableCollection(
  Arrays.asList(0, "a")
 );
}


More information:
Eclipse accepts this construct but jdk1.6.0_13 yields an error:

Test.java:4: incompatible types
found   : java.util.Collection<java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>
required: java.lang.Iterable<java.lang.Object>
 Iterable<Object> x = Collections.unmodifiableCollection(

I prefer the way Eclipse works.  This just a variant of issue 177715?
Comment 1 Kent Johnson CLA 2009-04-23 16:52:33 EDT
javac creates the parameter type to be :

List<Object&Serializable&Comparable<? extends Object&Serializable&Comparable<?>>>

where we create : 

List<Object&Comparable<?>&Serializable>
Comment 2 Kent Johnson CLA 2009-09-17 16:13:59 EDT

*** This bug has been marked as a duplicate of bug 142964 ***