-
Bug
-
Resolution: Fixed
-
P4
-
1.0.2, 1.1, 1.1.3
-
1.2alpha2
-
x86, sparc
-
solaris_2.5, windows_nt
-
Verified
Name: apC46001 Date: 12/18/96
JLS says [p. 167, 8.4.6.4 Inheriting Methods with the Same Signature]:
"It is possible for a class to inherit more than one method with the same signature.
Such a situation does not in itself cause a compile-time error.
There are then two possible cases:
If one of the inherited methods is not abstract, then there are two subcases:
...
Moreover, a compile-time error occurs if the inherited method that is not abstract
has a throws clause that conflicts with that of any other of the inherited methods.
...
"
JDK 1.1 compiler does not produce the needed error message for the test below.
> javac -d . clss17601.java
> java clss17601
--------------------------clss17601.java------------------------------
package javasoft.sqe.tests.lang.clss176.clss17601;
import java.io.PrintStream;
class Ex1 extends Exception {}
class Ex2 extends Exception {}
interface clss17601_a {
int m1();
}
class clss17601_b {
public int m1() throws Ex1 {
throw (new Ex1());
}
}
class clss17601_c extends clss17601_b implements clss17601_a {
int m2() throws Ex2 {
throw (new Ex2());
}
}
public class clss17601 {
public static void main(String argv[])
{
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
clss17601_c x = new clss17601_c();
return 2;
}
}
======================================================================
- duplicates
-
JDK-4078998 Compile-time checking of exceptions not always working...
-
- Closed
-