United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4972073 : (compound) same interface allowed twice in compound type

Details
Type:
Bug
Submit Date:
2003-12-23
Status:
Closed
Updated Date:
2017-05-16
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
tools
OS:
solaris_9
Sub-Component:
javac
CPU:
sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:

Related Reports

Sub Tasks

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.
                                     
2005-08-31
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
dragon
mustang


                                     
2004-09-07
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
                                     
2004-09-06
EVALUATION

Looks like a bug

###@###.### 2004-01-06
                                     
2004-01-06



Hardware and Software, Engineered to Work Together