Bug 133734 - [compiler] Eclipse compiler does not compile program while javac does
Summary: [compiler] Eclipse compiler does not compile program while javac does
Status: VERIFIED DUPLICATE of bug 79798
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-28 17:16 EST by e2e4e7e5f2f4@yahoo.de CLA
Modified: 2008-04-29 07:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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