Bug 114365 - [1.5][compiler] Eclipse won't compile certain Combinations of generics
Summary: [1.5][compiler] Eclipse won't compile certain Combinations of generics
Status: VERIFIED DUPLICATE of bug 113273
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-31 10:03 EST by dave leatherdale CLA
Modified: 2006-01-10 08:56 EST (History)
0 users

See Also:


Attachments
Example code (1.93 KB, text/plain)
2005-10-31 10:10 EST, dave leatherdale CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description dave leatherdale CLA 2005-10-31 10:03:57 EST
Sorry its difficult to be specific as i'm not sure exactly what about the class 
it's having problems with. Easiest thing is to post some examples of what does 
and doesn't work. I'm on sun jre1.5.0_03 Eclipse 3.11 (tried the lastest build 
of JDT core 3.2 i coud find too)

/*
 *Eclipse JDT will not compile the following class declertion
 *It claims i have not implemented the iterator() method. (which i have)
 */
public class test<A extends Collection & Serializable > implements Collection
/* 
 * The following definitions however do work correctly
 * public class test<A extends Cloneable & Serializable > implements Collection
 * public class test<A extends Collection & Serializable >
 * public class test<A extends Serializable > implements Collection
 * public class test<A extends Collection > implements Collection
 */
Comment 1 dave leatherdale CLA 2005-10-31 10:10:04 EST
Created attachment 28990 [details]
Example code
Comment 2 dave leatherdale CLA 2005-10-31 10:16:06 EST
Looking at it class files do seem to be being produced for the source however 
the UI is telling me its an error. Also if i create a new class extending the 
above it claims i have implemented the iterator() method twice.
Comment 3 Olivier Thomann CLA 2005-11-01 10:42:47 EST
This is fixed in latest.
Only 8 warnings are reported:

----------
1. WARNING in D:\tests_sources\X.java
 (at line 9)
	public class X<A extends Collection & Serializable > implements Collection
	                         ^^^^^^^^^^
Collection is a raw type. References to generic type Collection<E> should be
parameterized
----------
2. WARNING in D:\tests_sources\X.java
 (at line 9)
	public class X<A extends Collection & Serializable > implements Collection
	                                                                ^^^^^^^^^^
Collection is a raw type. References to generic type Collection<E> should be
parameterized
----------
3. WARNING in D:\tests_sources\X.java
 (at line 37)
	public Iterator iterator()
	       ^^^^^^^^
Iterator is a raw type. References to generic type Iterator<E> should be
parameterized
----------
4. WARNING in D:\tests_sources\X.java
 (at line 49)
	public Object[] toArray(Object[] arg0)
	       ^^^^^^^^
Type safety: The return type Object[] for toArray(Object[]) from the type X<A>
needs unchecked conversion to conform to T[] from the type Collection<E>
----------
5. WARNING in D:\tests_sources\X.java
 (at line 67)
	public boolean containsAll(Collection arg0)
	                           ^^^^^^^^^^
Collection is a raw type. References to generic type Collection<E> should be
parameterized
----------
6. WARNING in D:\tests_sources\X.java
 (at line 73)
	public boolean addAll(Collection arg0)
	                      ^^^^^^^^^^
Collection is a raw type. References to generic type Collection<E> should be
parameterized
----------
7. WARNING in D:\tests_sources\X.java
 (at line 79)
	public boolean removeAll(Collection arg0)
	                         ^^^^^^^^^^
Collection is a raw type. References to generic type Collection<E> should be
parameterized
----------
8. WARNING in D:\tests_sources\X.java
 (at line 85)
	public boolean retainAll(Collection arg0)
	                         ^^^^^^^^^^
Collection is a raw type. References to generic type Collection<E> should be
parameterized
----------
8 problems (8 warnings)

Kent, could this be a duplicate of a bug we fixed lately?
Comment 4 Kent Johnson CLA 2005-11-01 13:08:05 EST

*** This bug has been marked as a duplicate of 113273 ***
Comment 5 Olivier Thomann CLA 2005-11-04 10:21:42 EST
Added regression test
org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test868
Comment 6 Frederic Fusier CLA 2006-01-10 08:56:20 EST
Verified for 3.1.2 using build M20060109-1200.