Support loading Java records

^KT-43677 In Progress
This commit is contained in:
Denis.Zharkov
2020-11-23 16:02:26 +03:00
parent f25b7672a7
commit 513f7177ca
45 changed files with 688 additions and 61 deletions
@@ -0,0 +1,35 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.checkers;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/diagnostics/testsWithJava15")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJdk15Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTestsWithJava15() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("simpleRecords.kt")
public void testSimpleRecords() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJava15/simpleRecords.kt");
}
}
@@ -123,6 +123,10 @@ fun main(args: Array<String>) {
model("diagnostics/testsWithJava9")
}
testClass<AbstractDiagnosticsWithJdk15Test> {
model("diagnostics/testsWithJava15")
}
testClass<AbstractDiagnosticsWithUnsignedTypes> {
model("diagnostics/testsWithUnsignedTypes")
}
@@ -309,6 +313,15 @@ fun main(args: Array<String>) {
model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava")
}
testClass<AbstractLoadJava15Test> {
model("loadJava15", extension = "java", testMethod = "doTestCompiledJava", testClassName = "CompiledJava")
model("loadJava15", extension = "java", testMethod = "doTestSourceJava", testClassName = "SourceJava")
}
testClass<AbstractLoadJava15WithPsiClassReadingTest> {
model("loadJava15", extension = "java", testMethod = "doTestCompiledJava")
}
testClass<AbstractCompileJavaAgainstKotlinTest> {
model(
"compileJavaAgainstKotlin",
@@ -0,0 +1,66 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.jvm.compiler;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@RunWith(JUnit3RunnerWithInners.class)
public class LoadJava15TestGenerated extends AbstractLoadJava15Test {
@TestMetadata("compiler/testData/loadJava15")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CompiledJava extends AbstractLoadJava15Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava15"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("GenericRecord.java")
public void testGenericRecord() throws Exception {
runTest("compiler/testData/loadJava15/GenericRecord.java");
}
@TestMetadata("SimpleRecord.java")
public void testSimpleRecord() throws Exception {
runTest("compiler/testData/loadJava15/SimpleRecord.java");
}
}
@TestMetadata("compiler/testData/loadJava15")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SourceJava extends AbstractLoadJava15Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestSourceJava, this, testDataFilePath);
}
public void testAllFilesPresentInSourceJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava15"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("GenericRecord.java")
public void testGenericRecord() throws Exception {
runTest("compiler/testData/loadJava15/GenericRecord.java");
}
@TestMetadata("SimpleRecord.java")
public void testSimpleRecord() throws Exception {
runTest("compiler/testData/loadJava15/SimpleRecord.java");
}
}
}
@@ -0,0 +1,40 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.jvm.compiler;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/loadJava15")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class LoadJava15WithPsiClassReadingTestGenerated extends AbstractLoadJava15WithPsiClassReadingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInLoadJava15() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava15"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("GenericRecord.java")
public void testGenericRecord() throws Exception {
runTest("compiler/testData/loadJava15/GenericRecord.java");
}
@TestMetadata("SimpleRecord.java")
public void testSimpleRecord() throws Exception {
runTest("compiler/testData/loadJava15/SimpleRecord.java");
}
}