-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
6u20, 6u29, 7
-
generic, x86
-
generic, windows_xp, windows_7
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.
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.
- duplicates
-
JDK-6938489 The problem with the multiple bounds for the generic type
- Closed
-
JDK-7111664 javac behavior and reported bug questionable
- Closed
- relates to
-
JDK-7120669 4.9: Clarify well-formedness for intersection types & bounded type variables
- Open
-
JDK-6711619 javac doesn't allow access to protected members in intersection types
- Closed
-
JDK-6644562 4.9: Simplify membership of single-bound intersection types
- Open