Java 8 rules for method overrides:

- base class method wins against a (default) interface method,
so an abstract base class method should always be implemented
in a derived class;

- interface methods clash regardless of abstract/default
with possibly undefined behavior at run-time,
so a class or interface should always define its own method
for methods inherited from multiple interfaces and not from base class;

- meaningful diagnostics for class inheriting conflicting JVM signatures.
Since no override will happen under Java 8 rules,
ACCIDENTAL_OVERRIDE is misleading for this case;

- update testData.
This commit is contained in:
Dmitry Petrov
2015-10-07 14:43:39 +03:00
parent 82c0265cb3
commit 5d9ee7efee
46 changed files with 381 additions and 212 deletions
@@ -77,18 +77,6 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
doTest(fileName);
}
@TestMetadata("fakeGenericContravariantOverride1.kt")
public void testFakeGenericContravariantOverride1() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt");
doTest(fileName);
}
@TestMetadata("fakeGenericContravariantOverride2.kt")
public void testFakeGenericContravariantOverride2() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt");
doTest(fileName);
}
@TestMetadata("fakeGenericCovariantOverride.kt")
public void testFakeGenericCovariantOverride() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
@@ -101,24 +89,12 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
doTest(fileName);
}
@TestMetadata("fakeOverrideOfPropertySetterInTraitImpl.kt")
public void testFakeOverrideOfPropertySetterInTraitImpl() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt");
doTest(fileName);
}
@TestMetadata("fakeOverrideOfTraitImpl.kt")
public void testFakeOverrideOfTraitImpl() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt");
doTest(fileName);
}
@TestMetadata("fakeOverrideWithImplementationInTrait.kt")
public void testFakeOverrideWithImplementationInTrait() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt");
doTest(fileName);
}
@TestMetadata("fakeOverrideWithSeveralSuperDeclarations.kt")
public void testFakeOverrideWithSeveralSuperDeclarations() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt");