Bug 148957 - [1.5][compiler] Inheritance with generic parameter poses problem if formulated differently
Summary: [1.5][compiler] Inheritance with generic parameter poses problem if formulate...
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-28 05:09 EDT by Volker Renneberg CLA
Modified: 2006-06-28 07:28 EDT (History)
0 users

See Also:


Attachments
SuperInterface (183 bytes, text/plain)
2006-06-28 05:10 EDT, Volker Renneberg CLA
no flags Details
ProblemClass (206 bytes, text/plain)
2006-06-28 05:11 EDT, Volker Renneberg CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Renneberg CLA 2006-06-28 05:09:10 EDT
Hi!

I do not know, whether this is an eclipse bug or not:

Assume, you have the following interface:

import java.util.Collection;
import javax.swing.JLabel;
public interface SuperInterface {
   public <A extends JLabel> void doIt(Collection<A> as);
}

and the following class, that inherits from the interface:

import java.util.Collection;
import javax.swing.JLabel;
public class ProblemClass implements SuperInterface {
   public void doIt(Collection<? extends JLabel> as) {
   }
}

Eclipse 3.2RC7 does not recognize the implementing method as an implementation. It says, there is a name clash.

ciao
Volker
Comment 1 Volker Renneberg CLA 2006-06-28 05:10:22 EDT
Created attachment 45450 [details]
SuperInterface

The given interface is in a package called "inheritance".
Comment 2 Volker Renneberg CLA 2006-06-28 05:11:15 EDT
Created attachment 45451 [details]
ProblemClass

The given interface is in a package called "inheritance".
Comment 3 Philipe Mulet CLA 2006-06-28 07:17:00 EDT
This is the intended behavior. Javac 1.6b88 agrees with us. Now I agree on the surface this is questionnable as a wildcard is usually considered to act as a type parameter when only referenced once...

To avoid the problem, define instead the following, which will be somewhat equivalent.

class ProblemClass implements SuperInterface {
   public <B extends JLabel> void doIt(Collection<B> as) {
   }
}

Added MethodVerifyTest#test095-096
Comment 4 Philipe Mulet CLA 2006-06-28 07:28:14 EDT
Actually, tests are MethodVerifyTest#test096-097