Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Behaviour of default methods in ECJ

Hi Bruno

Please file a bug report against JDT Core with a test case.

Thanks,
Dani



From:        Yanlin Wang <huohuohuomumu@xxxxxxxxx>
To:        <jdt-core-dev@xxxxxxxxxxx>
Cc:        Haoyuan <zhanghaoyuan00@xxxxxxxxx>, Dr Bruno Oliveira <bruno@xxxxxxxxx>, Dr Marco Servetto <marco.servetto@xxxxxxxxx>
Date:        20.11.2015 16:25
Subject:        [jdt-core-dev] Behaviour of default methods in ECJ
Sent by:        jdt-core-dev-bounces@xxxxxxxxxxx




Hi Everyone,



We have found inconsistent behaviour of method resolution between

javac compiler and ECJ. We believe this is a bug in the ECJ compiler.



Here’s the problematic program:



interface A1 { int m(); }

interface B1 { default int m() { return 0; }}

interface M1 extends A1, B1 {} //rejected by both javac and ECJ



interface B2 extends B1 { int m(); }

interface B3 extends B2 { default int m() {return 1;}}

interface M2 extends A1, B3 {} //rejected by javac, but accepted by ECJ



The ECJ compiler we are using is :  ecj-4.5.1.jar

The javac compiler we are using is : javac 1.8.0_40



Here interface M1 is both rejected by javac and ECJ, the error message says

that the default method m() in B1 conflicts with the abstract method m() in

A1. Note that, in this case A1 and B1 are unrelated types.



Now the weird thing happens with M2, which extends A1 and B3 (also unrelated

types). M2 is rejected by javac (as we would expect) but accepted by ECJ.



Best Regards,


Bruno, Haoyuan, Marco and Yanlin

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-core-dev


Back to the top