Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [Version 6.1.7600] A DESCRIPTION OF THE PROBLEM : The compiler fails if a base interface includes a clone() method and an extended interface has multiple generic types. The error message is the same as Bug ID: 4185308 but the cause is different. (Note that the sample code compiles correctly in the Eclipse Java compiler.) STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Put the source code for an executable test case into two separate files in the same directory. Compile them. You should get a compiler error. ERROR MESSAGES/STACK TRACES THAT OCCUR : SubType.java:1: clone() in java.lang.Object cannot implement clone() in BaseType; attempting to assign weaker access privileges; was public public interface SubType<T extends BaseType & java.io.Closeable> extends BaseType { ^ 1 error REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public interface BaseType { BaseType clone() throws CloneNotSupportedException; } public interface SubType<T extends BaseType & java.io.Closeable> extends BaseType { } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Modify SubType so that the generic type parameter T extends only BaseType, not Closeable.
|