Community
Participate
Working Groups
If I have two interfaces with the same method, but with mismatching exception signatures, it's legal for me to have an implementation of those two interfaces that has a method with no exception thrown in its signature. It's also legal for me to have an intermediate interface that inherits from the two other interfaces. class AException extends Exception { } class BException extends Exception { } interface A { public void xyz() throws AException; } interface B { public void xyz() throws BException; } interface C extends A, B { } class D implements C { public void xyz() { System.out.println("In XYZ"); } } If I have a caller that uses the implementation type, it's clear that the caller shouldn't expect an exception to be thrown. If, however the caller uses the intervening interface type, Eclipse and javac seem to differ on the interpretation. public class InheritenceTest { public static void main(String[] args) { C c = new D(); c.xyz(); } } In that bit of sample code, javac (Sun 1.5.0_03) compiles it and runs with no trouble. Eclipse gives an error saying "Unhandled exception type AException" and refuses to build.
Reproduced in HEAD. ---------- 1. ERROR in D:\tests_sources\InheritenceTest.java (at line 5) c.xyz(); ^^^^^^^ Unhandled exception type AException ---------- 1 problem (1 error) javac 1.4 and 1.5 don't report any error.
jikes 1.22 doesn't report any error as well.
This is a dup of 79798 addressed in 3.4.0. Kent - pls close it properly, added regression test if needed.
Created attachment 118689 [details] Testcase
Test released for 3.5M4 *** This bug has been marked as a duplicate of bug 79798 ***
Verified for 3.5M4 using I20081208-1800