JDK-4972073 : (compound) same interface allowed twice in compound type
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2003-12-23
  • Updated: 2017-05-16
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b03Fixed OpenJDK6Resolved
Description
generic class signature allows to extends the same interface multiple times.
Ideally it should throw compile time here. 

Please find the below code. It compiles successfully. But I think it shouldn't compile it. Class B signature allows to extends the MyInterface<E> twice.

//-- Code start here --
//Test1.java
import java.lang.reflect.*;

public class Test1 {
	public static void main(String[] args) {
		B b = new B<Sun1>();
	}
}

class D { }

interface MyInterface<E> {
	public String foo();
}

class MyClass { }

class Sun1 extends MyClass implements MyInterface<Sun1>, MyInterface<Sun1> {
	public String foo() {
		return "test";
	}
}

class B < E extends MyClass & MyInterface<E> & MyInterface<E> > extends D {
}
//-- code end here

Comments
EVALUATION Is a bug.
31-08-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon mustang
07-09-2004

PUBLIC COMMENTS This program compiles, but I<E> is repeated in the bound of E: interface I<X> {} class C<E extends I<E> & I<E>> {} ###@###.### 2004-09-06
06-09-2004

EVALUATION Looks like a bug ###@###.### 2004-01-06
06-01-2004