Support compatibility mode for @JvmDefault

This commit is contained in:
Mikhael Bogdanov
2018-05-28 16:16:23 +02:00
parent 9b718e83a9
commit 340920fe38
19 changed files with 435 additions and 15 deletions
@@ -481,6 +481,49 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/superCall.kt");
}
@TestMetadata("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Compatibility extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInCompatibility() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("bridge.kt")
public void testBridge() throws Exception {
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/bridge.kt");
}
@TestMetadata("bridge2.kt")
public void testBridge2() throws Exception {
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/bridge2.kt");
}
@TestMetadata("bridge3.kt")
public void testBridge3() throws Exception {
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/bridge3.kt");
}
@TestMetadata("defaultArgs.kt")
public void testDefaultArgs() throws Exception {
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/defaultArgs.kt");
}
@TestMetadata("inheritedJvmDefault.kt")
public void testInheritedJvmDefault() throws Exception {
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/inheritedJvmDefault.kt");
}
@TestMetadata("simpleFunction.kt")
public void testSimpleFunction() throws Exception {
runTest("compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/simpleFunction.kt");
}
}
@TestMetadata("compiler/testData/codegen/java8/box/jvm8/defaults/delegationBy")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -51,4 +51,45 @@ public class BytecodeTextJava8TestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/java8/bytecodeText/hashCode/hashCode.kt");
}
}
@TestMetadata("compiler/testData/codegen/java8/bytecodeText/jvmDefault")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class JvmDefault extends AbstractBytecodeTextTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInJvmDefault() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/bytecodeText/jvmDefault"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("compiler/testData/codegen/java8/bytecodeText/jvmDefault/compatibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Compatibility extends AbstractBytecodeTextTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInCompatibility() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/bytecodeText/jvmDefault/compatibility"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("defaultArgs.kt")
public void testDefaultArgs() throws Exception {
runTest("compiler/testData/codegen/java8/bytecodeText/jvmDefault/compatibility/defaultArgs.kt");
}
@TestMetadata("simpleFunction.kt")
public void testSimpleFunction() throws Exception {
runTest("compiler/testData/codegen/java8/bytecodeText/jvmDefault/compatibility/simpleFunction.kt");
}
@TestMetadata("simpleFunctionWithAbstractOverride.kt")
public void testSimpleFunctionWithAbstractOverride() throws Exception {
runTest("compiler/testData/codegen/java8/bytecodeText/jvmDefault/compatibility/simpleFunctionWithAbstractOverride.kt");
}
}
}
}