Bug 133734

Summary: [compiler] Eclipse compiler does not compile program while javac does
Product: [Eclipse Project] JDT Reporter: e2e4e7e5f2f4 <e2e4e7e5f2f4>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: david_audel, kent_johnson
Version: 3.1.2   
Target Milestone: 3.4 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description e2e4e7e5f2f4@yahoo.de CLA 2006-03-28 17:16:57 EST
// Puzzle 37 from "Java Puzzlers" by Joshua Bloch and Neal Gafter

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();
  }
}


This program does not compile within Eclipse 3.1.2 using JRE 1.5.0_02
but it does compile using the JDK 1.5.0_02 directly.
Eclipse reports "Unhandled exception type CloneNotSupportedException" in line 19.
The OS used in both cases is Windows XP.
Comment 1 Olivier Thomann CLA 2006-03-29 11:59:17 EST
I think it is worth reporting the explanation 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."
This means that f cannot throw any checked exceptions at all. So the code should compile.
Comment 2 Kent Johnson CLA 2006-03-29 13:14:30 EST
This is the same as bug 79798
Comment 3 Philipe Mulet CLA 2006-03-29 14:04:05 EST

*** This bug has been marked as a duplicate of 79798 ***
Comment 4 David Audel CLA 2008-04-29 07:31:56 EDT
Verified for 3.4M7 using I20080427-2000