[Test] Migrate tests of foreign annotations to new infrastructure

This commit includes:
- test runners for foreign annotation tests
- minor changes testdata related to changed directives syntax
- dropping tests with javac integration: old javac tests actually ran
    compiler without javac because of bug in configuration, so some
    nullability annotations features are not supported in javac mode.
    It's fine to drop it since javac mode is not fully supported
    by compiler
This commit is contained in:
Dmitriy Novozhilov
2020-12-22 16:08:14 +03:00
committed by TeamCityServer
parent ef3d966d53
commit 660c438ebe
176 changed files with 2451 additions and 2970 deletions
@@ -0,0 +1,659 @@
/*
* 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.test.runners;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
public class ForeignAnnotationsNoAnnotationInClasspathTestGenerated extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests")
@TestDataPath("$PROJECT_ROOT")
public class Tests extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("androidRecently.kt")
public void testAndroidRecently() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidRecently.kt");
}
@Test
@TestMetadata("androidSdk.kt")
public void testAndroidSdk() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidSdk.kt");
}
@Test
@TestMetadata("android_support.kt")
public void testAndroid_support() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/android_support.kt");
}
@Test
@TestMetadata("androidx.kt")
public void testAndroidx() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidx.kt");
}
@Test
@TestMetadata("aosp.kt")
public void testAosp() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/aosp.kt");
}
@Test
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/checkerFramework.kt");
}
@Test
@TestMetadata("eclipse.kt")
public void testEclipse() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/eclipse.kt");
}
@Test
@TestMetadata("findBugsSimple.kt")
public void testFindBugsSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/findBugsSimple.kt");
}
@Test
@TestMetadata("irrelevantQualifierNicknames.kt")
public void testIrrelevantQualifierNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/irrelevantQualifierNicknames.kt");
}
@Test
@TestMetadata("lombokSimple.kt")
public void testLombokSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/lombokSimple.kt");
}
@Test
@TestMetadata("rxjava.kt")
public void testRxjava() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/rxjava.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305 extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInJsr305() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("nonNullNever.kt")
public void testNonNullNever() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nonNullNever.kt");
}
@Test
@TestMetadata("nullabilityNicknames.kt")
public void testNullabilityNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityNicknames.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/simple.kt");
}
@Test
@TestMetadata("strange.kt")
public void testStrange() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/strange.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/ignore")
@TestDataPath("$PROJECT_ROOT")
public class Ignore extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInIgnore() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/ignore"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/ignore/parametersAreNonnullByDefault.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings")
@TestDataPath("$PROJECT_ROOT")
public class NullabilityWarnings extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInNullabilityWarnings() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/elvis.kt");
}
@Test
@TestMetadata("localInference.kt")
public void testLocalInference() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/localInference.kt");
}
@Test
@TestMetadata("nullabilityGenerics.kt")
public void testNullabilityGenerics() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/nullabilityGenerics.kt");
}
@Test
@TestMetadata("nullabilityNicknames.kt")
public void testNullabilityNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/nullabilityNicknames.kt");
}
@Test
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/safeCalls.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/simple.kt");
}
@Test
@TestMetadata("strange.kt")
public void testStrange() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/strange.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes")
@TestDataPath("$PROJECT_ROOT")
public class FromPlatformTypes extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInFromPlatformTypes() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("arithmetic.kt")
public void testArithmetic() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.kt");
}
@Test
@TestMetadata("array.kt")
public void testArray() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.kt");
}
@Test
@TestMetadata("assignToVar.kt")
public void testAssignToVar() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.kt");
}
@Test
@TestMetadata("conditions.kt")
public void testConditions() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.kt");
}
@Test
@TestMetadata("dataFlowInfo.kt")
public void testDataFlowInfo() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.kt");
}
@Test
@TestMetadata("defaultParameters.kt")
public void testDefaultParameters() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.kt");
}
@Test
@TestMetadata("delegatedProperties.kt")
public void testDelegatedProperties() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.kt");
}
@Test
@TestMetadata("delegation.kt")
public void testDelegation() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.kt");
}
@Test
@TestMetadata("derefenceExtension.kt")
public void testDerefenceExtension() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.kt");
}
@Test
@TestMetadata("derefenceMember.kt")
public void testDerefenceMember() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.kt");
}
@Test
@TestMetadata("expectedType.kt")
public void testExpectedType() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.kt");
}
@Test
@TestMetadata("functionArguments.kt")
public void testFunctionArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.kt");
}
@Test
@TestMetadata("invoke.kt")
public void testInvoke() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.kt");
}
@Test
@TestMetadata("kt6829.kt")
public void testKt6829() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.kt");
}
@Test
@TestMetadata("multiDeclaration.kt")
public void testMultiDeclaration() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.kt");
}
@Test
@TestMetadata("passToJava.kt")
public void testPassToJava() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.kt");
}
@Test
@TestMetadata("primitiveArray.kt")
public void testPrimitiveArray() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.kt");
}
@Test
@TestMetadata("throw.kt")
public void testThrow() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.kt");
}
@Test
@TestMetadata("uselessElvisRightIsNull.kt")
public void testUselessElvisRightIsNull() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("equalsOnNonNull.kt")
public void testEqualsOnNonNull() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.kt");
}
@Test
@TestMetadata("fieldsAreNullable.kt")
public void testFieldsAreNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt");
}
@Test
@TestMetadata("nullabilityFromOverridden.kt")
public void testNullabilityFromOverridden() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.kt");
}
@Test
@TestMetadata("overridingDefaultQualifier.kt")
public void testOverridingDefaultQualifier() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefaultPackage.kt")
public void testParametersAreNonnullByDefaultPackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt");
}
@Test
@TestMetadata("springNullable.kt")
public void testSpringNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.kt");
}
@Test
@TestMetadata("springNullablePackage.kt")
public void testSpringNullablePackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("fieldsAreNullable.kt")
public void testFieldsAreNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt");
}
@Test
@TestMetadata("forceFlexibility.kt")
public void testForceFlexibility() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/forceFlexibility.kt");
}
@Test
@TestMetadata("forceFlexibleOverOverrides.kt")
public void testForceFlexibleOverOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.kt");
}
@Test
@TestMetadata("nullabilityFromOverridden.kt")
public void testNullabilityFromOverridden() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt");
}
@Test
@TestMetadata("overridingDefaultQualifier.kt")
public void testOverridingDefaultQualifier() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefaultPackage.kt")
public void testParametersAreNonnullByDefaultPackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt");
}
@Test
@TestMetadata("springNullable.kt")
public void testSpringNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/springNullable.kt");
}
@Test
@TestMetadata("springNullablePackage.kt")
public void testSpringNullablePackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/springNullablePackage.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305NullabilityWarnings extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInJsr305NullabilityWarnings() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration")
@TestDataPath("$PROJECT_ROOT")
public class Migration extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInMigration() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("customMigration.kt")
public void testCustomMigration() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/customMigration.kt");
}
@Test
@TestMetadata("globalIgnore.kt")
public void testGlobalIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/globalIgnore.kt");
}
@Test
@TestMetadata("globalWarningMigrationIgnore.kt")
public void testGlobalWarningMigrationIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.kt");
}
@Test
@TestMetadata("migrationError.kt")
public void testMigrationError() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationError.kt");
}
@Test
@TestMetadata("migrationIgnore.kt")
public void testMigrationIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationIgnore.kt");
}
@Test
@TestMetadata("migrationWarning.kt")
public void testMigrationWarning() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationWarning.kt");
}
@Test
@TestMetadata("overrideConflicts.kt")
public void testOverrideConflicts() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/overrideConflicts.kt");
}
@Test
@TestMetadata("specialCollision.kt")
public void testSpecialCollision() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/specialCollision.kt");
}
@Test
@TestMetadata("stateRefinement.kt")
public void testStateRefinement() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/stateRefinement.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("defaultAndNicknameMigrationPolicy.kt")
public void testDefaultAndNicknameMigrationPolicy() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests")
@TestDataPath("$PROJECT_ROOT")
public class Java8Tests extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInJava8Tests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@Test
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/checkerFramework.kt");
}
@Test
@TestMetadata("eclipse.kt")
public void testEclipse() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/eclipse.kt");
}
@Test
@TestMetadata("typeUseOnObject.kt")
public void testTypeUseOnObject() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeUseOnObject.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/jsr305")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305 extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInJsr305() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("defaultAnnotationAppliedToType.kt")
public void testDefaultAnnotationAppliedToType() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/defaultAnnotationAppliedToType.kt");
}
@Test
@TestMetadata("defaultAnnotationAppliedToTypeForCompiledJava.kt")
public void testDefaultAnnotationAppliedToTypeForCompiledJava() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt");
}
@Test
@TestMetadata("springNullableWithTypeUse.kt")
public void testSpringNullableWithTypeUse() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/springNullableWithTypeUse.kt");
}
@Test
@TestMetadata("typeArguments.kt")
public void testTypeArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/typeArguments.kt");
}
@Test
@TestMetadata("typeUseVsMethodConflict.kt")
public void testTypeUseVsMethodConflict() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/typeUseVsMethodConflict.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement")
@TestDataPath("$PROJECT_ROOT")
public class TypeEnhancement extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
@Test
public void testAllFilesPresentInTypeEnhancement() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotatedTypeArguments.kt")
public void testAnnotatedTypeArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/annotatedTypeArguments.kt");
}
@Test
@TestMetadata("methodWithTypeParameter.kt")
public void testMethodWithTypeParameter() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/methodWithTypeParameter.kt");
}
@Test
@TestMetadata("notNullVarargsOverrides.kt")
public void testNotNullVarargsOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/notNullVarargsOverrides.kt");
}
@Test
@TestMetadata("nullableVarargsOverrides.kt")
public void testNullableVarargsOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/nullableVarargsOverrides.kt");
}
@Test
@TestMetadata("returnTypeDifferentConstructor.kt")
public void testReturnTypeDifferentConstructor() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/returnTypeDifferentConstructor.kt");
}
@Test
@TestMetadata("returnTypeOverrideInKotlin.kt")
public void testReturnTypeOverrideInKotlin() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/returnTypeOverrideInKotlin.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/simple.kt");
}
}
}
}
@@ -0,0 +1,659 @@
/*
* 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.test.runners;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
public class ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGenerated extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests")
@TestDataPath("$PROJECT_ROOT")
public class Tests extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("androidRecently.kt")
public void testAndroidRecently() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidRecently.kt");
}
@Test
@TestMetadata("androidSdk.kt")
public void testAndroidSdk() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidSdk.kt");
}
@Test
@TestMetadata("android_support.kt")
public void testAndroid_support() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/android_support.kt");
}
@Test
@TestMetadata("androidx.kt")
public void testAndroidx() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidx.kt");
}
@Test
@TestMetadata("aosp.kt")
public void testAosp() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/aosp.kt");
}
@Test
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/checkerFramework.kt");
}
@Test
@TestMetadata("eclipse.kt")
public void testEclipse() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/eclipse.kt");
}
@Test
@TestMetadata("findBugsSimple.kt")
public void testFindBugsSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/findBugsSimple.kt");
}
@Test
@TestMetadata("irrelevantQualifierNicknames.kt")
public void testIrrelevantQualifierNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/irrelevantQualifierNicknames.kt");
}
@Test
@TestMetadata("lombokSimple.kt")
public void testLombokSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/lombokSimple.kt");
}
@Test
@TestMetadata("rxjava.kt")
public void testRxjava() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/rxjava.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305 extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInJsr305() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("nonNullNever.kt")
public void testNonNullNever() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nonNullNever.kt");
}
@Test
@TestMetadata("nullabilityNicknames.kt")
public void testNullabilityNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityNicknames.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/simple.kt");
}
@Test
@TestMetadata("strange.kt")
public void testStrange() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/strange.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/ignore")
@TestDataPath("$PROJECT_ROOT")
public class Ignore extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInIgnore() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/ignore"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/ignore/parametersAreNonnullByDefault.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings")
@TestDataPath("$PROJECT_ROOT")
public class NullabilityWarnings extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInNullabilityWarnings() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/elvis.kt");
}
@Test
@TestMetadata("localInference.kt")
public void testLocalInference() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/localInference.kt");
}
@Test
@TestMetadata("nullabilityGenerics.kt")
public void testNullabilityGenerics() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/nullabilityGenerics.kt");
}
@Test
@TestMetadata("nullabilityNicknames.kt")
public void testNullabilityNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/nullabilityNicknames.kt");
}
@Test
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/safeCalls.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/simple.kt");
}
@Test
@TestMetadata("strange.kt")
public void testStrange() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/strange.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes")
@TestDataPath("$PROJECT_ROOT")
public class FromPlatformTypes extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInFromPlatformTypes() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("arithmetic.kt")
public void testArithmetic() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.kt");
}
@Test
@TestMetadata("array.kt")
public void testArray() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.kt");
}
@Test
@TestMetadata("assignToVar.kt")
public void testAssignToVar() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.kt");
}
@Test
@TestMetadata("conditions.kt")
public void testConditions() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.kt");
}
@Test
@TestMetadata("dataFlowInfo.kt")
public void testDataFlowInfo() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.kt");
}
@Test
@TestMetadata("defaultParameters.kt")
public void testDefaultParameters() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.kt");
}
@Test
@TestMetadata("delegatedProperties.kt")
public void testDelegatedProperties() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.kt");
}
@Test
@TestMetadata("delegation.kt")
public void testDelegation() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.kt");
}
@Test
@TestMetadata("derefenceExtension.kt")
public void testDerefenceExtension() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.kt");
}
@Test
@TestMetadata("derefenceMember.kt")
public void testDerefenceMember() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.kt");
}
@Test
@TestMetadata("expectedType.kt")
public void testExpectedType() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.kt");
}
@Test
@TestMetadata("functionArguments.kt")
public void testFunctionArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.kt");
}
@Test
@TestMetadata("invoke.kt")
public void testInvoke() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.kt");
}
@Test
@TestMetadata("kt6829.kt")
public void testKt6829() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.kt");
}
@Test
@TestMetadata("multiDeclaration.kt")
public void testMultiDeclaration() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.kt");
}
@Test
@TestMetadata("passToJava.kt")
public void testPassToJava() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.kt");
}
@Test
@TestMetadata("primitiveArray.kt")
public void testPrimitiveArray() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.kt");
}
@Test
@TestMetadata("throw.kt")
public void testThrow() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.kt");
}
@Test
@TestMetadata("uselessElvisRightIsNull.kt")
public void testUselessElvisRightIsNull() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("equalsOnNonNull.kt")
public void testEqualsOnNonNull() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.kt");
}
@Test
@TestMetadata("fieldsAreNullable.kt")
public void testFieldsAreNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt");
}
@Test
@TestMetadata("nullabilityFromOverridden.kt")
public void testNullabilityFromOverridden() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.kt");
}
@Test
@TestMetadata("overridingDefaultQualifier.kt")
public void testOverridingDefaultQualifier() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefaultPackage.kt")
public void testParametersAreNonnullByDefaultPackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt");
}
@Test
@TestMetadata("springNullable.kt")
public void testSpringNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.kt");
}
@Test
@TestMetadata("springNullablePackage.kt")
public void testSpringNullablePackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("fieldsAreNullable.kt")
public void testFieldsAreNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt");
}
@Test
@TestMetadata("forceFlexibility.kt")
public void testForceFlexibility() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/forceFlexibility.kt");
}
@Test
@TestMetadata("forceFlexibleOverOverrides.kt")
public void testForceFlexibleOverOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.kt");
}
@Test
@TestMetadata("nullabilityFromOverridden.kt")
public void testNullabilityFromOverridden() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt");
}
@Test
@TestMetadata("overridingDefaultQualifier.kt")
public void testOverridingDefaultQualifier() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefaultPackage.kt")
public void testParametersAreNonnullByDefaultPackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt");
}
@Test
@TestMetadata("springNullable.kt")
public void testSpringNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/springNullable.kt");
}
@Test
@TestMetadata("springNullablePackage.kt")
public void testSpringNullablePackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/springNullablePackage.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305NullabilityWarnings extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInJsr305NullabilityWarnings() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration")
@TestDataPath("$PROJECT_ROOT")
public class Migration extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInMigration() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("customMigration.kt")
public void testCustomMigration() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/customMigration.kt");
}
@Test
@TestMetadata("globalIgnore.kt")
public void testGlobalIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/globalIgnore.kt");
}
@Test
@TestMetadata("globalWarningMigrationIgnore.kt")
public void testGlobalWarningMigrationIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.kt");
}
@Test
@TestMetadata("migrationError.kt")
public void testMigrationError() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationError.kt");
}
@Test
@TestMetadata("migrationIgnore.kt")
public void testMigrationIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationIgnore.kt");
}
@Test
@TestMetadata("migrationWarning.kt")
public void testMigrationWarning() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationWarning.kt");
}
@Test
@TestMetadata("overrideConflicts.kt")
public void testOverrideConflicts() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/overrideConflicts.kt");
}
@Test
@TestMetadata("specialCollision.kt")
public void testSpecialCollision() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/specialCollision.kt");
}
@Test
@TestMetadata("stateRefinement.kt")
public void testStateRefinement() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/stateRefinement.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("defaultAndNicknameMigrationPolicy.kt")
public void testDefaultAndNicknameMigrationPolicy() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests")
@TestDataPath("$PROJECT_ROOT")
public class Java8Tests extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInJava8Tests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@Test
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/checkerFramework.kt");
}
@Test
@TestMetadata("eclipse.kt")
public void testEclipse() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/eclipse.kt");
}
@Test
@TestMetadata("typeUseOnObject.kt")
public void testTypeUseOnObject() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeUseOnObject.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/jsr305")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305 extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInJsr305() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("defaultAnnotationAppliedToType.kt")
public void testDefaultAnnotationAppliedToType() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/defaultAnnotationAppliedToType.kt");
}
@Test
@TestMetadata("defaultAnnotationAppliedToTypeForCompiledJava.kt")
public void testDefaultAnnotationAppliedToTypeForCompiledJava() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt");
}
@Test
@TestMetadata("springNullableWithTypeUse.kt")
public void testSpringNullableWithTypeUse() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/springNullableWithTypeUse.kt");
}
@Test
@TestMetadata("typeArguments.kt")
public void testTypeArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/typeArguments.kt");
}
@Test
@TestMetadata("typeUseVsMethodConflict.kt")
public void testTypeUseVsMethodConflict() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/typeUseVsMethodConflict.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement")
@TestDataPath("$PROJECT_ROOT")
public class TypeEnhancement extends AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
@Test
public void testAllFilesPresentInTypeEnhancement() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotatedTypeArguments.kt")
public void testAnnotatedTypeArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/annotatedTypeArguments.kt");
}
@Test
@TestMetadata("methodWithTypeParameter.kt")
public void testMethodWithTypeParameter() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/methodWithTypeParameter.kt");
}
@Test
@TestMetadata("notNullVarargsOverrides.kt")
public void testNotNullVarargsOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/notNullVarargsOverrides.kt");
}
@Test
@TestMetadata("nullableVarargsOverrides.kt")
public void testNullableVarargsOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/nullableVarargsOverrides.kt");
}
@Test
@TestMetadata("returnTypeDifferentConstructor.kt")
public void testReturnTypeDifferentConstructor() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/returnTypeDifferentConstructor.kt");
}
@Test
@TestMetadata("returnTypeOverrideInKotlin.kt")
public void testReturnTypeOverrideInKotlin() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/returnTypeOverrideInKotlin.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/simple.kt");
}
}
}
}
@@ -0,0 +1,659 @@
/*
* 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.test.runners;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
public class ForeignAnnotationsTestGenerated extends AbstractForeignAnnotationsTest {
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests")
@TestDataPath("$PROJECT_ROOT")
public class Tests extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("androidRecently.kt")
public void testAndroidRecently() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidRecently.kt");
}
@Test
@TestMetadata("androidSdk.kt")
public void testAndroidSdk() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidSdk.kt");
}
@Test
@TestMetadata("android_support.kt")
public void testAndroid_support() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/android_support.kt");
}
@Test
@TestMetadata("androidx.kt")
public void testAndroidx() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/androidx.kt");
}
@Test
@TestMetadata("aosp.kt")
public void testAosp() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/aosp.kt");
}
@Test
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/checkerFramework.kt");
}
@Test
@TestMetadata("eclipse.kt")
public void testEclipse() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/eclipse.kt");
}
@Test
@TestMetadata("findBugsSimple.kt")
public void testFindBugsSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/findBugsSimple.kt");
}
@Test
@TestMetadata("irrelevantQualifierNicknames.kt")
public void testIrrelevantQualifierNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/irrelevantQualifierNicknames.kt");
}
@Test
@TestMetadata("lombokSimple.kt")
public void testLombokSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/lombokSimple.kt");
}
@Test
@TestMetadata("rxjava.kt")
public void testRxjava() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/rxjava.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305 extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInJsr305() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("nonNullNever.kt")
public void testNonNullNever() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nonNullNever.kt");
}
@Test
@TestMetadata("nullabilityNicknames.kt")
public void testNullabilityNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityNicknames.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/simple.kt");
}
@Test
@TestMetadata("strange.kt")
public void testStrange() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/strange.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/ignore")
@TestDataPath("$PROJECT_ROOT")
public class Ignore extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInIgnore() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/ignore"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/ignore/parametersAreNonnullByDefault.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings")
@TestDataPath("$PROJECT_ROOT")
public class NullabilityWarnings extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInNullabilityWarnings() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/elvis.kt");
}
@Test
@TestMetadata("localInference.kt")
public void testLocalInference() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/localInference.kt");
}
@Test
@TestMetadata("nullabilityGenerics.kt")
public void testNullabilityGenerics() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/nullabilityGenerics.kt");
}
@Test
@TestMetadata("nullabilityNicknames.kt")
public void testNullabilityNicknames() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/nullabilityNicknames.kt");
}
@Test
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/safeCalls.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/simple.kt");
}
@Test
@TestMetadata("strange.kt")
public void testStrange() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/strange.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes")
@TestDataPath("$PROJECT_ROOT")
public class FromPlatformTypes extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInFromPlatformTypes() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("arithmetic.kt")
public void testArithmetic() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.kt");
}
@Test
@TestMetadata("array.kt")
public void testArray() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.kt");
}
@Test
@TestMetadata("assignToVar.kt")
public void testAssignToVar() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.kt");
}
@Test
@TestMetadata("conditions.kt")
public void testConditions() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.kt");
}
@Test
@TestMetadata("dataFlowInfo.kt")
public void testDataFlowInfo() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.kt");
}
@Test
@TestMetadata("defaultParameters.kt")
public void testDefaultParameters() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.kt");
}
@Test
@TestMetadata("delegatedProperties.kt")
public void testDelegatedProperties() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.kt");
}
@Test
@TestMetadata("delegation.kt")
public void testDelegation() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.kt");
}
@Test
@TestMetadata("derefenceExtension.kt")
public void testDerefenceExtension() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.kt");
}
@Test
@TestMetadata("derefenceMember.kt")
public void testDerefenceMember() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.kt");
}
@Test
@TestMetadata("expectedType.kt")
public void testExpectedType() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.kt");
}
@Test
@TestMetadata("functionArguments.kt")
public void testFunctionArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.kt");
}
@Test
@TestMetadata("invoke.kt")
public void testInvoke() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.kt");
}
@Test
@TestMetadata("kt6829.kt")
public void testKt6829() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.kt");
}
@Test
@TestMetadata("multiDeclaration.kt")
public void testMultiDeclaration() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.kt");
}
@Test
@TestMetadata("passToJava.kt")
public void testPassToJava() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.kt");
}
@Test
@TestMetadata("primitiveArray.kt")
public void testPrimitiveArray() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.kt");
}
@Test
@TestMetadata("throw.kt")
public void testThrow() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.kt");
}
@Test
@TestMetadata("uselessElvisRightIsNull.kt")
public void testUselessElvisRightIsNull() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("equalsOnNonNull.kt")
public void testEqualsOnNonNull() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.kt");
}
@Test
@TestMetadata("fieldsAreNullable.kt")
public void testFieldsAreNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt");
}
@Test
@TestMetadata("nullabilityFromOverridden.kt")
public void testNullabilityFromOverridden() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.kt");
}
@Test
@TestMetadata("overridingDefaultQualifier.kt")
public void testOverridingDefaultQualifier() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefaultPackage.kt")
public void testParametersAreNonnullByDefaultPackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt");
}
@Test
@TestMetadata("springNullable.kt")
public void testSpringNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.kt");
}
@Test
@TestMetadata("springNullablePackage.kt")
public void testSpringNullablePackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("fieldsAreNullable.kt")
public void testFieldsAreNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt");
}
@Test
@TestMetadata("forceFlexibility.kt")
public void testForceFlexibility() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/forceFlexibility.kt");
}
@Test
@TestMetadata("forceFlexibleOverOverrides.kt")
public void testForceFlexibleOverOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.kt");
}
@Test
@TestMetadata("nullabilityFromOverridden.kt")
public void testNullabilityFromOverridden() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt");
}
@Test
@TestMetadata("overridingDefaultQualifier.kt")
public void testOverridingDefaultQualifier() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefault.kt")
public void testParametersAreNonnullByDefault() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt");
}
@Test
@TestMetadata("parametersAreNonnullByDefaultPackage.kt")
public void testParametersAreNonnullByDefaultPackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt");
}
@Test
@TestMetadata("springNullable.kt")
public void testSpringNullable() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/springNullable.kt");
}
@Test
@TestMetadata("springNullablePackage.kt")
public void testSpringNullablePackage() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305/typeQualifierDefault/springNullablePackage.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305NullabilityWarnings extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInJsr305NullabilityWarnings() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration")
@TestDataPath("$PROJECT_ROOT")
public class Migration extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInMigration() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("customMigration.kt")
public void testCustomMigration() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/customMigration.kt");
}
@Test
@TestMetadata("globalIgnore.kt")
public void testGlobalIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/globalIgnore.kt");
}
@Test
@TestMetadata("globalWarningMigrationIgnore.kt")
public void testGlobalWarningMigrationIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.kt");
}
@Test
@TestMetadata("migrationError.kt")
public void testMigrationError() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationError.kt");
}
@Test
@TestMetadata("migrationIgnore.kt")
public void testMigrationIgnore() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationIgnore.kt");
}
@Test
@TestMetadata("migrationWarning.kt")
public void testMigrationWarning() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/migrationWarning.kt");
}
@Test
@TestMetadata("overrideConflicts.kt")
public void testOverrideConflicts() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/overrideConflicts.kt");
}
@Test
@TestMetadata("specialCollision.kt")
public void testSpecialCollision() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/specialCollision.kt");
}
@Test
@TestMetadata("stateRefinement.kt")
public void testStateRefinement() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings/migration/stateRefinement.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault")
@TestDataPath("$PROJECT_ROOT")
public class TypeQualifierDefault extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInTypeQualifierDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("defaultAndNicknameMigrationPolicy.kt")
public void testDefaultAndNicknameMigrationPolicy() throws Exception {
runTest("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests")
@TestDataPath("$PROJECT_ROOT")
public class Java8Tests extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInJava8Tests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@Test
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/checkerFramework.kt");
}
@Test
@TestMetadata("eclipse.kt")
public void testEclipse() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/eclipse.kt");
}
@Test
@TestMetadata("typeUseOnObject.kt")
public void testTypeUseOnObject() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeUseOnObject.kt");
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/jsr305")
@TestDataPath("$PROJECT_ROOT")
public class Jsr305 extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInJsr305() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("defaultAnnotationAppliedToType.kt")
public void testDefaultAnnotationAppliedToType() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/defaultAnnotationAppliedToType.kt");
}
@Test
@TestMetadata("defaultAnnotationAppliedToTypeForCompiledJava.kt")
public void testDefaultAnnotationAppliedToTypeForCompiledJava() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt");
}
@Test
@TestMetadata("springNullableWithTypeUse.kt")
public void testSpringNullableWithTypeUse() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/springNullableWithTypeUse.kt");
}
@Test
@TestMetadata("typeArguments.kt")
public void testTypeArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/typeArguments.kt");
}
@Test
@TestMetadata("typeUseVsMethodConflict.kt")
public void testTypeUseVsMethodConflict() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/jsr305/typeUseVsMethodConflict.kt");
}
}
@Nested
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement")
@TestDataPath("$PROJECT_ROOT")
public class TypeEnhancement extends AbstractForeignAnnotationsTest {
@Test
public void testAllFilesPresentInTypeEnhancement() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotatedTypeArguments.kt")
public void testAnnotatedTypeArguments() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/annotatedTypeArguments.kt");
}
@Test
@TestMetadata("methodWithTypeParameter.kt")
public void testMethodWithTypeParameter() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/methodWithTypeParameter.kt");
}
@Test
@TestMetadata("notNullVarargsOverrides.kt")
public void testNotNullVarargsOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/notNullVarargsOverrides.kt");
}
@Test
@TestMetadata("nullableVarargsOverrides.kt")
public void testNullableVarargsOverrides() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/nullableVarargsOverrides.kt");
}
@Test
@TestMetadata("returnTypeDifferentConstructor.kt")
public void testReturnTypeDifferentConstructor() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/returnTypeDifferentConstructor.kt");
}
@Test
@TestMetadata("returnTypeOverrideInKotlin.kt")
public void testReturnTypeOverrideInKotlin() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/returnTypeOverrideInKotlin.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancement/simple.kt");
}
}
}
}
@@ -55,4 +55,11 @@ object DiagnosticsDirectives : SimpleDirectivesContainer() {
is enabled in test
""".trimIndent()
)
val RENDER_PACKAGE by stringDirective(
description = """
Dump declaration from packages listed in directive
(additional to root package)
""".trimIndent()
)
}
@@ -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.test.directives
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
import org.jetbrains.kotlin.test.services.configuration.JdkForeignAnnotationType
import org.jetbrains.kotlin.utils.ReportLevel
@Suppress("RemoveExplicitTypeArguments")
object ForeignAnnotationsDirectives : SimpleDirectivesContainer() {
val JSR305_GLOBAL_REPORT by enumDirective<ReportLevel>(
description = "Global report level",
additionalParser = ReportLevel.Companion::findByDescription
)
val JSR305_MIGRATION_REPORT by enumDirective<ReportLevel>(
description = "Migration report level",
additionalParser = ReportLevel.Companion::findByDescription
)
val JSR305_SPECIAL_REPORT by stringDirective(
description = "Report level for specific annotations"
)
val JSPECIFY_STATE by enumDirective<ReportLevel>(
description = "Report level for jSpecify annotations",
additionalParser = ReportLevel.Companion::findByDescription
)
val ANNOTATIONS_PATH by enumDirective<JdkForeignAnnotationType>(
description = "Path to foreign annotations"
)
val SOURCE_RETENTION_ANNOTATIONS by directive(
description = "Skip test against compiled annotation because of their Source retention"
)
}
@@ -33,4 +33,5 @@ object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() {
val USE_PSI_CLASS_FILES_READING by directive("Use a slower (PSI-based) class files reading implementation")
val USE_JAVAC by directive("Enable javac integration")
val SKIP_JAVA_SOURCES by directive("Don't add java sources to compile classpath")
}
@@ -66,6 +66,7 @@ class DeclarationsDumpHandler(
assertions.assertEqualsToFile(expectedFile, resultDump)
}
@OptIn(ExperimentalStdlibApi::class)
override fun processModule(module: TestModule, info: ClassicFrontendOutputArtifact) {
if (DiagnosticsDirectives.SKIP_TXT in module.directives) return
val moduleDescriptor = info.analysisResult.moduleDescriptor
@@ -73,7 +74,12 @@ class DeclarationsDumpHandler(
val comparator = RecursiveDescriptorComparator(
createdAffectedPackagesConfiguration(module.files, info.ktFiles, moduleDescriptor, checkTypeEnabled)
)
val packages = listOf(FqName.ROOT)
val packages = buildList {
module.directives[DiagnosticsDirectives.RENDER_PACKAGE].forEach {
add(FqName(it))
}
add(FqName.ROOT)
}
val textByPackage = packages.keysToMap { StringBuilder() }
for ((packageName, packageText) in textByPackage.entries) {
@@ -0,0 +1,111 @@
/*
* 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.test.runners
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.test.builders.Constructor
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.SKIP_TXT
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives.ANNOTATIONS_PATH
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.SKIP_JAVA_SOURCES
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_JAVAC
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
import org.jetbrains.kotlin.test.frontend.classic.handlers.DeclarationsDumpHandler
import org.jetbrains.kotlin.test.frontend.classic.handlers.OldNewInferenceMetaInfoProcessor
import org.jetbrains.kotlin.test.model.BackendKind
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.services.AdditionalDiagnosticsSourceFilesProvider
import org.jetbrains.kotlin.test.services.CoroutineHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.services.configuration.JdkForeignAnnotationType
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmForeignAnnotationsAgainstCompiledJavaConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmForeignAnnotationsConfigurator
import org.jetbrains.kotlin.test.services.jvm.ForeignAnnotationAgainstCompiledJavaTestSuppressor
abstract class AbstractForeignAnnotationsTestBase : AbstractKotlinCompilerTest() {
protected abstract val foreignAnnotationsConfigurator: Constructor<JvmForeignAnnotationsConfigurator>
override fun TestConfigurationBuilder.configuration() {
globalDefaults {
frontend = FrontendKinds.ClassicFrontend
backend = BackendKind.NoBackend
targetPlatform = JvmPlatforms.defaultJvmPlatform
dependencyKind = DependencyKind.Source
}
defaultDirectives {
+REPORT_JVM_DIAGNOSTICS_ON_FRONTEND
}
enableMetaInfoHandler()
useConfigurators(
::JvmEnvironmentConfigurator,
foreignAnnotationsConfigurator
)
useMetaInfoProcessors(::OldNewInferenceMetaInfoProcessor)
useAdditionalSourceProviders(
::AdditionalDiagnosticsSourceFilesProvider,
::CoroutineHelpersSourceFilesProvider,
)
useFrontendFacades(::ClassicFrontendFacade)
useFrontendHandlers(
::DeclarationsDumpHandler,
::ClassicDiagnosticsHandler,
)
forTestsMatching("compiler/testData/foreignAnnotations/tests/*") {
defaultDirectives {
ANNOTATIONS_PATH with JdkForeignAnnotationType.Annotations
}
}
forTestsMatching("compiler/testData/foreignAnnotations/java8Tests/*") {
defaultDirectives {
ANNOTATIONS_PATH with JdkForeignAnnotationType.Jdk8Annotations
}
}
}
}
abstract class AbstractForeignAnnotationsTest : AbstractForeignAnnotationsTestBase() {
override val foreignAnnotationsConfigurator: Constructor<JvmForeignAnnotationsConfigurator>
get() = ::JvmForeignAnnotationsConfigurator
}
abstract class AbstractForeignAnnotationsNoAnnotationInClasspathTest : AbstractForeignAnnotationsTestBase() {
override val foreignAnnotationsConfigurator: Constructor<JvmForeignAnnotationsConfigurator>
get() = ::JvmForeignAnnotationsAgainstCompiledJavaConfigurator
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+SKIP_JAVA_SOURCES
+SKIP_TXT
}
useMetaTestConfigurators(::ForeignAnnotationAgainstCompiledJavaTestSuppressor)
}
}
}
abstract class AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest : AbstractForeignAnnotationsNoAnnotationInClasspathTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+USE_PSI_CLASS_FILES_READING
}
}
}
}
@@ -107,9 +107,11 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
val isIr = module.backendKind == BackendKinds.IrBackend
configuration.put(JVMConfigurationKeys.IR, isIr)
module.javaFiles.takeIf { it.isNotEmpty() }?.let { javaFiles ->
javaFiles.forEach { testServices.sourceFileProvider.getRealFileForSourceFile(it) }
configuration.addJavaSourceRoot(testServices.sourceFileProvider.javaSourceDirectory)
if (JvmEnvironmentConfigurationDirectives.SKIP_JAVA_SOURCES !in module.directives) {
module.javaFiles.takeIf { it.isNotEmpty() }?.let { javaFiles ->
javaFiles.forEach { testServices.sourceFileProvider.getRealFileForSourceFile(it) }
configuration.addJavaSourceRoot(testServices.sourceFileProvider.javaSourceDirectory)
}
}
configuration.registerModuleDependencies(module)
@@ -0,0 +1,131 @@
/*
* 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.test.services.configuration
import com.intellij.mock.MockProject
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRoot
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
import org.jetbrains.kotlin.codegen.CodegenTestUtil
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.config.AnalysisFlag
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JvmAnalysisFlags
import org.jetbrains.kotlin.test.MockLibraryUtil
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives.JSPECIFY_STATE
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives.JSR305_GLOBAL_REPORT
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives.JSR305_MIGRATION_REPORT
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives.JSR305_SPECIAL_REPORT
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.*
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.jetbrains.kotlin.utils.JavaTypeEnhancementState
import org.jetbrains.kotlin.utils.ReportLevel
import java.io.File
enum class JdkForeignAnnotationType(val path: String) {
Annotations("third-party/annotations"),
Jdk8Annotations("third-party/jdk8-annotations");
companion object {
val FOREIGN_ANNOTATIONS_SOURCES_PATH = Annotations.path
val FOREIGN_JDK8_ANNOTATIONS_SOURCES_PATH = Jdk8Annotations.path
}
}
open class JvmForeignAnnotationsConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) {
companion object {
private const val TEST_ANNOTATIONS_SOURCE_PATH = "compiler/testData/foreignAnnotations/testAnnotations"
}
override val directivesContainers: List<DirectivesContainer>
get() = listOf(ForeignAnnotationsDirectives)
@OptIn(ExperimentalStdlibApi::class)
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule, project: MockProject) {
val extraClassPath = buildList {
val foreignAnnotations = createJarWithForeignAnnotations(module)
addAll(foreignAnnotations)
addAll(compileTestAnnotations(foreignAnnotations))
}
configuration.addJvmClasspathRoots(extraClassPath)
}
protected fun createJarWithForeignAnnotations(module: TestModule): List<File> {
val directive = ForeignAnnotationsDirectives.ANNOTATIONS_PATH
val annotationsPath = module.directives.singleOrZeroValue(directive)
?.path
?: error("${directive.name} should be specified in test or test runner")
return listOf(
MockLibraryUtil.compileJavaFilesLibraryToJar(annotationsPath, "foreign-annotations", assertions = JUnit5Assertions),
ForTestCompileRuntime.jvmAnnotationsForTests()
)
}
protected fun compileTestAnnotations(extraClassPath: List<File>): List<File> =
listOf(
MockLibraryUtil.compileJavaFilesLibraryToJar(
TEST_ANNOTATIONS_SOURCE_PATH,
"test-foreign-annotations",
extraOptions = listOf("-Xallow-kotlin-package"),
extraClasspath = extraClassPath.map { it.path },
assertions = JUnit5Assertions
)
)
override fun provideAdditionalAnalysisFlags(directives: RegisteredDirectives): Map<AnalysisFlag<*>, Any?> {
val globalState = directives.singleOrZeroValue(JSR305_GLOBAL_REPORT) ?: ReportLevel.STRICT
val migrationState = directives.singleOrZeroValue(JSR305_MIGRATION_REPORT)
val userAnnotationsState = directives[JSR305_SPECIAL_REPORT].mapNotNull {
val (name, stateDescription) = it.split(":").takeIf { it.size == 2 } ?: return@mapNotNull null
val state = ReportLevel.findByDescription(stateDescription) ?: return@mapNotNull null
name to state
}.toMap()
val jSpecifyReportLevel = directives.singleOrZeroValue(JSPECIFY_STATE) ?: ReportLevel.STRICT
return mapOf(
JvmAnalysisFlags.javaTypeEnhancementState to JavaTypeEnhancementState(
globalState,
migrationState,
userAnnotationsState,
jspecifyReportLevel = jSpecifyReportLevel
)
)
}
}
class JvmForeignAnnotationsAgainstCompiledJavaConfigurator(testServices: TestServices) : JvmForeignAnnotationsConfigurator(testServices) {
@OptIn(ExperimentalStdlibApi::class)
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule, project: MockProject) {
val compiledJavaPath = KtTestUtil.tmpDir("java-compiled-files")
val foreignAnnotations = createJarWithForeignAnnotations(module)
val testAnnotations = compileTestAnnotations(foreignAnnotations)
val additionalClasspath = buildList {
addAll(foreignAnnotations)
addAll(testAnnotations)
}.map { it.path }
module.javaFiles.forEach { testServices.sourceFileProvider.getRealFileForSourceFile(it) }
CodegenTestUtil.compileJava(
CodegenTestUtil.findJavaSourcesInDirectory(testServices.sourceFileProvider.javaSourceDirectory),
additionalClasspath,
emptyList(),
compiledJavaPath,
JUnit5Assertions
)
val extraClassPath = buildList {
add(compiledJavaPath)
addAll(testAnnotations)
}
configuration.addJvmClasspathRoots(extraClassPath)
}
}
@@ -0,0 +1,19 @@
/*
* 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.test.services.jvm
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives.SOURCE_RETENTION_ANNOTATIONS
import org.jetbrains.kotlin.test.services.MetaTestConfigurator
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.moduleStructure
import org.jetbrains.kotlin.test.utils.isDirectiveDefined
class ForeignAnnotationAgainstCompiledJavaTestSuppressor(testServices: TestServices) : MetaTestConfigurator(testServices) {
override fun shouldSkipTest(): Boolean {
val testFile = testServices.moduleStructure.originalTestDataFiles.first()
return testFile.isDirectiveDefined("// ${SOURCE_RETENTION_ANNOTATIONS.name}")
}
}
@@ -32,3 +32,11 @@ fun File.withExtension(extension: String): File {
val extension = extension.removePrefix(".")
return parentFile.resolve("$nameWithoutExtension.$extension")
}
/*
* Please use this method only in places where `TestModule` is not accessible
* In other cases use testModule.directives
*/
fun File.isDirectiveDefined(directive: String): Boolean = this.useLines { line ->
line.any { it == directive }
}