Eclipse 4.3 で default method に switch + Enum を使うと例外が出る

Eclipse 4.3 + JDT/Eclipse Java 8 Support For Kepler - Eclipsepedia な 環境で次のようなコードを書くと実行時に例外が出ました。

package sample;

public class Test {
  public static void main(String... args) {
    System.out.println(System.getProperty("java.version"));
    new Impl();
  }
}
enum TestE {
  A, B
}
interface TestI {
  default void method() {
    TestE e = TestE.A;
    switch (e) {
    default:
    }
  }
}
class Impl implements TestI {
}

実行結果

1.8.0_05
Exception in thread "main" java.lang.ClassFormatError: Illegal field modifiers in class sample/TestI: 0x100A

幾つかの環境で試してみましたが、例外が出るのは Eclipse 4.3 位でした。*1

環境 例外発生
javac + java ×
Maven Compiler Plugin v3.1 ×
Gradle2.0 ×
Eclipse 4.3
Eclipse 4.4 ×

使ってる Tool 類も Eclipse 4.4 でほぼ問題無く動くようになってきたので、4.4 に乗り換えですね。

GGTS(Groovy/Grails Tool Suite) の 3.6 正式版が最近出た。*2
Download GGTS
JBoss Tools 4.2 beta (WildFly 8系)
Chris Ritchies Weblog: How to use Java 8 with WildFly 8 and Eclipse

*1:Maven Compiler Plugin v2.6 辺りでも例外出た

*2:3.6 beta だと groovy や grails ファイルのエディタが起動しなかった