JVM IR: Support parameterless main methods

This commit:

- introduces tests explicating what is and isn't considered a
  proper main method on the JVM backends.
- implements support for parameterless main methods on the JVM IR
  backend
- See KT-34338 for more tests.
This commit is contained in:
Kristoffer Andersen
2019-10-14 11:58:02 +02:00
committed by Alexander Udalov
parent 4b77db8979
commit 28b6913a25
18 changed files with 346 additions and 5 deletions
@@ -3438,6 +3438,39 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/parameterlessMain")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ParameterlessMain extends AbstractBytecodeTextTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInParameterlessMain() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/parameterlessMain"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("dontGenerateOnJvmNameMain.kt")
public void testDontGenerateOnJvmNameMain() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/parameterlessMain/dontGenerateOnJvmNameMain.kt");
}
@TestMetadata("dontGenerateOnMain.kt")
public void testDontGenerateOnMain() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/parameterlessMain/dontGenerateOnMain.kt");
}
@TestMetadata("dontGenerateOnMainExtension.kt")
public void testDontGenerateOnMainExtension() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/parameterlessMain/dontGenerateOnMainExtension.kt");
}
@TestMetadata("dontGenerateOnNullableArray.kt")
public void testDontGenerateOnNullableArray() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/parameterlessMain/dontGenerateOnNullableArray.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/properties")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)