Community
Participate
Working Groups
Build ID: N20071111-0010 Steps To Reproduce: The code sample is taken from Java Puzzlers problem 37. Expected Result: The code should compile fine Actual Result: ecj reports unhandled exception code ---- interface Type1 { void f() throws CloneNotSupportedException; } interface Type2 { void f() throws InterruptedException; } interface Type3 extends Type1, Type2 {} public class Arcane3 implements Type3 { public void f() { System.out.println("Hello world"); } public static void main(String[] args) { Type3 t3 = new Arcane3(); t3.f(); } } problem ------- The method f in interface Type3 doesn't throw any exception so main method needn't handle any exception, but eclipse requires CloneNotSupportedException to be handled. Quoting from the book "The set of checked exceptions that a method can throw is the intersection of the sets of checked exceptions that it is declared to throw in all applicable types, not the union. As a result, the f method on an object whose static type is Type3 can't throw any checked exceptions at all. Therefore, Arcane3 compiles without error and prints Hello world." More information:
Indeed, we should be intersecting exception types.
seems the same as bug 79798
Fixed with the same change as bug 79798 *** This bug has been marked as a duplicate of bug 79798 ***
Verified for 3.4M7 using I20080427-2000