static vs. default interface methods and inheritance VM/javac issues

Peter Levart peter.levart at
Thu Sep 12 07:59:21 PDT 2013


While testing behavior of reflection on default and static interface 
methods, using self-built JDK from latest tip of jdk8/tl, I found:

The following program:

public class DefaultVsStaticInterfaceMethodTest {
     public interface A {
         default void m() {
             System.out.println("A.m() called");

     public interface B {
         static void m() {
             System.out.println("B.m() called");

     public interface C extends A, B {

     public static void main(String[] args) throws Exception {
         C c = new C() {};

...compiles, but gives a runtime error:

Exception in thread "main" java.lang.AbstractMethodError: Conflicting 
default methods: DefaultVsStaticInterfaceMethodTest$A.m 

A slightly modified program: "C extends A, B" replaced with "C extends 
B, A":

...also compiles, but crashes the VM when run:

# A fatal error has been detected by the Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0x00007fd4d5020bf9, pid=9964, tid=140552419804928
# JRE version: OpenJDK Runtime Environment (8.0) (build 
# Java VM: OpenJDK 64-Bit Server VM (25.0-b48 mixed mode linux-amd64 
compressed oops)
# Problematic frame:
# j  DefaultVsStaticInterfaceMethodTest.main([Ljava/lang/String;)V+9
# Failed to write core dump. Core dumps have been disabled. To enable 
core dumping, try "ulimit -c unlimited" before starting Java again
# An error report file with more information is saved as:
# /home/peter/work/git/jdk8-tl/out/production/test/hs_err_pid9964.log
# If you would like to submit a bug report, please visit:
Aborted (core dumped)

Here's the hs_err_pid file:

Regards, Peter

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the compiler-dev mailing list