Bug 85416 - Compiler allows inheritance from generic interface with different args
Summary: Compiler allows inheritance from generic interface with different args
Status: RESOLVED DUPLICATE of bug 81824
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: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-16 09:55 EST by Neil Bartlett CLA
Modified: 2005-02-16 10:10 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Bartlett CLA 2005-02-16 09:55:23 EST
The built-in compiler in JDT allows me to implement an Generic interface
multiple times with different arguments, for example:

interface Handler<T> {
  void handle(T foo);
}
class MultiHandler implements Handler<String>, Handler<Integer> {
  public void handle(String foo) {
    System.out.println("Handling String...");
  }
  public void handle(Integer foo) {
    System.out.println("Handling Integer...");
  }
}

This compiles cleanly with no warnings in Eclipse JDT, but is not legal Java.
The resulting classfile cannot be run in the Sun JVM.
Comment 1 Neil Bartlett CLA 2005-02-16 09:57:56 EST
Sorry, this is in 3.1 M4
Comment 2 Olivier Thomann CLA 2005-02-16 10:05:39 EST
The compiler now reports:
----------
1. ERROR in c:\tests_sources\X.java
 (at line 4)
	class X implements Handler<String>, Handler<Integer> {
	      ^
Duplicate interface Handler<T> for the type X
----------
1 problem
Comment 3 Olivier Thomann CLA 2005-02-16 10:10:34 EST

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