From 33251f6d5006939a47ae9dee3a8cc9916d16b33f Mon Sep 17 00:00:00 2001 From: pyos Date: Thu, 29 Jul 2021 15:38:53 +0200 Subject: [PATCH] Generate foreign annotation test data for FIR --- ...nAnnotationsCompiledJavaTestGenerated.java | 1129 +++++++++++++++++ ...dJavaWithPsiClassReadingTestGenerated.java | 1129 +++++++++++++++++ ...ignAnnotationsSourceJavaTestGenerated.java | 1129 +++++++++++++++++ .../java8Tests/checkerFramework.kt | 1 + .../java8Tests/eclipse.kt | 1 + .../AnnotatedBoundsOfWildcard.fir.kt | 81 ++ .../jspecify/strictMode/Captured.kt | 1 + .../jspecify/strictMode/Defaults.fir.kt | 46 + .../strictMode/IgnoreAnnotations.fir.kt | 44 + .../NonPlatformTypeParameter.fir.kt | 27 + .../NullnessUnspecifiedTypeParameter.fir.kt | 31 + .../jspecify/strictMode/SelfType.fir.kt | 53 + .../jspecify/strictMode/Simple.fir.kt | 37 + .../TypeArgumentsFromParameterBounds.fir.kt | 46 + .../strictMode/TypeParameterBounds.fir.kt | 40 + .../strictMode/WildcardsWithDefault.fir.kt | 35 + .../java8Tests/jspecify/strictMode/kt47396.kt | 1 + .../jspecify/strictMode/kt47422.fir.kt | 135 ++ .../jspecify/strictMode/kt47437.fir.kt | 18 + .../warnMode/AnnotatedBoundsOfWildcard.fir.kt | 80 ++ .../java8Tests/jspecify/warnMode/Captured.kt | 1 + .../jspecify/warnMode/Defaults.fir.kt | 45 + .../warnMode/IgnoreAnnotations.fir.kt | 43 + .../warnMode/NonPlatformTypeParameter.fir.kt | 27 + .../NullnessUnspecifiedTypeParameter.fir.kt | 30 + .../jspecify/warnMode/SelfType.fir.kt | 54 + .../jspecify/warnMode/Simple.fir.kt | 36 + .../TypeArgumentsFromParameterBounds.fir.kt | 45 + .../warnMode/TypeParameterBounds.fir.kt | 39 + .../warnMode/WildcardsWithDefault.fir.kt | 35 + .../jspecify/warnMode/kt47899.fir.kt | 15 + .../defaultAnnotationAppliedToType.fir.kt | 77 ++ ...otationAppliedToTypeForCompiledJava.fir.kt | 67 + .../jsr305/springNullableWithTypeUse.fir.kt | 79 ++ .../java8Tests/jsr305/typeArguments.fir.kt | 107 ++ .../jsr305/typeUseVsMethodConflict.fir.kt | 77 ++ .../java8Tests/misc/annotatedTypeArguments.kt | 1 + .../misc/classTypeParameterBound.fir.kt | 25 + ...classTypeParameterBoundWithWarnings.fir.kt | 25 + .../misc/enhancedRecursiveStarProjection.kt | 1 + .../misc/methodWithTypeParameter.kt | 1 + .../misc/notNullVarargsOverrides.fir.kt | 21 + .../misc/nullableVarargsOverrides.fir.kt | 21 + .../java8Tests/misc/returnType.fir.kt | 65 + .../misc/returnTypeDifferentConstructor.kt | 1 + .../misc/returnTypeOverrideInKotlin.fir.kt | 31 + .../misc/returnTypeWithWarnings.fir.kt | 67 + .../java8Tests/misc/simple.kt | 1 + ...rameterAnnotationToEnhanceItsUsages.fir.kt | 14 + .../java8Tests/misc/valueParameter.fir.kt | 62 + .../misc/valueParameterWithWarnings.fir.kt | 64 + .../warningsBasedOnEnhancedBasedType.fir.kt | 23 + .../java8Tests/typeUseOnObject.kt | 1 + .../moduleAnnotations/strict/basic.fir.kt | 25 + .../composeWithClassDefaultAnnotation.kt | 3 +- ...composeWithPackageDefaultAnnotation.fir.kt | 31 + .../strict/dependentModulesNoNullMarked.kt | 3 +- .../strict/dependentModulesNullMarked.fir.kt | 30 + ...nnotationToAnotherModuleWithSamePackage.kt | 3 +- .../strict/dotNamedModule.fir.kt | 25 + .../strict/inheritanceAcrossModules.fir.kt | 45 + .../strict/nestedClasses.fir.kt | 43 + .../strict/overrideAtDeclarationLevel.kt | 3 +- .../severalModulesDifferentPackages.fir.kt | 39 + .../moduleAnnotations/warn/basic.fir.kt | 25 + .../composeWithClassDefaultAnnotation.fir.kt | 28 + ...composeWithPackageDefaultAnnotation.fir.kt | 31 + .../warn/dependentModulesNoNullMarked.kt | 3 +- .../warn/dependentModulesNullMarked.fir.kt | 30 + ...nnotationToAnotherModuleWithSamePackage.kt | 3 +- .../warn/dotNamedModule.fir.kt | 25 + .../warn/inheritanceAcrossModules.fir.kt | 45 + .../warn/nestedClasses.fir.kt | 43 + .../warn/overrideAtDeclarationLevel.kt | 4 +- .../severalModulesDifferentPackages.fir.kt | 39 + .../tests/androidRecently.fir.kt | 52 + .../tests/androidSdk.kt | 1 + .../tests/android_support.kt | 1 + .../foreignAnnotationsTests/tests/androidx.kt | 1 + .../foreignAnnotationsTests/tests/aosp.kt | 1 + .../tests/checkerFramework.kt | 1 + .../foreignAnnotationsTests/tests/eclipse.kt | 1 + .../tests/findBugsSimple.kt | 1 + .../tests/irrelevantQualifierNicknames.kt | 1 + .../dontIgnoreAnnotationsWithoutTarget.kt | 1 + .../parametersAreNonnullByDefault.fir.kt | 33 + .../tests/jsr305/nonNullNever.kt | 1 + .../tests/jsr305/nullabilityNicknames.kt | 1 + .../jsr305/nullabilityWarnings/elvis.fir.kt | 85 ++ .../fromPlatformTypes/arithmetic.fir.kt | 49 + .../fromPlatformTypes/array.fir.kt | 25 + .../fromPlatformTypes/assignToVar.fir.kt | 24 + .../fromPlatformTypes/conditions.fir.kt | 42 + .../fromPlatformTypes/dataFlowInfo.fir.kt | 29 + .../defaultParameters.fir.kt | 22 + .../delegatedProperties.fir.kt | 21 + .../fromPlatformTypes/delegation.fir.kt | 17 + .../derefenceExtension.fir.kt | 39 + .../fromPlatformTypes/derefenceMember.fir.kt | 37 + .../fromPlatformTypes/expectedType.fir.kt | 26 + .../fromPlatformTypes/for.fir.kt | 23 + .../functionArguments.fir.kt | 25 + .../fromPlatformTypes/invoke.fir.kt | 21 + .../fromPlatformTypes/kt6829.fir.kt | 21 + .../fromPlatformTypes/multiDeclaration.fir.kt | 27 + .../fromPlatformTypes/passToJava.fir.kt | 88 ++ .../fromPlatformTypes/primitiveArray.fir.kt | 25 + .../fromPlatformTypes/throw.fir.kt | 23 + .../uselessElvisRightIsNull.fir.kt | 32 + .../nullabilityWarnings/localInference.fir.kt | 96 ++ .../nullabilityGenerics.fir.kt | 40 + .../nullabilityNicknames.fir.kt | 91 ++ .../jsr305/nullabilityWarnings/safeCalls.kt | 1 + .../jsr305/nullabilityWarnings/simple.kt | 1 + .../jsr305/nullabilityWarnings/strange.kt | 1 + .../equalsOnNonNull.fir.kt | 46 + .../fieldsAreNullable.fir.kt | 57 + .../nullabilityFromOverridden.fir.kt | 152 +++ .../overridingDefaultQualifier.fir.kt | 181 +++ .../parametersAreNonnullByDefault.fir.kt | 33 + ...arametersAreNonnullByDefaultPackage.fir.kt | 68 + .../springNullable.fir.kt | 79 ++ .../springNullablePackage.fir.kt | 84 ++ .../tests/jsr305/simple.kt | 1 + .../tests/jsr305/strange.kt | 1 + .../typeQualifierDefault/fieldsAreNullable.kt | 1 + .../typeQualifierDefault/forceFlexibility.kt | 1 + .../forceFlexibleOverOverrides.fir.kt | 92 ++ .../nullabilityFromOverridden.fir.kt | 152 +++ .../overridingDefaultQualifier.fir.kt | 181 +++ .../parametersAreNonnullByDefault.kt | 1 + ...arametersAreNonnullByDefaultPackage.fir.kt | 70 + .../typeQualifierDefault/springNullable.kt | 1 + .../springNullablePackage.fir.kt | 85 ++ .../migration/customMigration.fir.kt | 82 ++ .../migration/globalIgnore.fir.kt | 55 + .../globalWarningMigrationIgnore.fir.kt | 55 + .../migration/migrationError.fir.kt | 76 ++ .../migration/migrationIgnore.fir.kt | 55 + .../migration/migrationWarning.fir.kt | 55 + .../migration/overrideConflicts.fir.kt | 85 ++ .../migration/specialCollision.fir.kt | 35 + .../migration/stateRefinement.fir.kt | 55 + .../foreignAnnotationsTests/tests/kt47833.kt | 1 + .../foreignAnnotationsTests/tests/kt47920.kt | 1 + .../tests/lombokSimple.kt | 1 + .../tests/multiple.fir.kt | 158 +++ .../foreignAnnotationsTests/tests/rxjava.kt | 1 + .../tests/rxjava3Default.fir.kt | 41 + .../tests/rxjava3Errors.kt | 3 +- .../tests/rxjava3Ignore.fir.kt | 43 + .../tests/rxjava3Warnings.fir.kt | 43 + .../defaultAndNicknameMigrationPolicy.fir.kt | 64 + .../generators/GenerateJUnit5CompilerTests.kt | 24 + 154 files changed, 9029 insertions(+), 8 deletions(-) create mode 100644 compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java create mode 100644 compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java create mode 100644 compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsSourceJavaTestGenerated.java create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.fir.kt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java new file mode 100644 index 00000000000..66c7ec44925 --- /dev/null +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java @@ -0,0 +1,1129 @@ +/* + * Copyright 2010-2021 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 FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated extends AbstractFirForeignAnnotationsCompiledJavaTest { + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests") + @TestDataPath("$PROJECT_ROOT") + public class Tests { + @Test + public void testAllFilesPresentInTests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("androidRecently.kt") + public void testAndroidRecently() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.kt"); + } + + @Test + @TestMetadata("androidSdk.kt") + public void testAndroidSdk() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt"); + } + + @Test + @TestMetadata("android_support.kt") + public void testAndroid_support() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt"); + } + + @Test + @TestMetadata("androidx.kt") + public void testAndroidx() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt"); + } + + @Test + @TestMetadata("aosp.kt") + public void testAosp() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt"); + } + + @Test + @TestMetadata("checkerFramework.kt") + public void testCheckerFramework() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt"); + } + + @Test + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt"); + } + + @Test + @TestMetadata("findBugsSimple.kt") + public void testFindBugsSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt"); + } + + @Test + @TestMetadata("irrelevantQualifierNicknames.kt") + public void testIrrelevantQualifierNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt"); + } + + @Test + @TestMetadata("kt47833.kt") + public void testKt47833() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt"); + } + + @Test + @TestMetadata("kt47920.kt") + public void testKt47920() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt"); + } + + @Test + @TestMetadata("lombokSimple.kt") + public void testLombokSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt"); + } + + @Test + @TestMetadata("multiple.kt") + public void testMultiple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.kt"); + } + + @Test + @TestMetadata("rxjava.kt") + public void testRxjava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt"); + } + + @Test + @TestMetadata("rxjava3Default.kt") + public void testRxjava3Default() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.kt"); + } + + @Test + @TestMetadata("rxjava3Errors.kt") + public void testRxjava3Errors() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt"); + } + + @Test + @TestMetadata("rxjava3Ignore.kt") + public void testRxjava3Ignore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.kt"); + } + + @Test + @TestMetadata("rxjava3Warnings.kt") + public void testRxjava3Warnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305 { + @Test + public void testAllFilesPresentInJsr305() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("dontIgnoreAnnotationsWithoutTarget.kt") + public void testDontIgnoreAnnotationsWithoutTarget() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt"); + } + + @Test + @TestMetadata("nonNullNever.kt") + public void testNonNullNever() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt"); + } + + @Test + @TestMetadata("nullabilityNicknames.kt") + public void testNullabilityNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt"); + } + + @Test + @TestMetadata("strange.kt") + public void testStrange() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore") + @TestDataPath("$PROJECT_ROOT") + public class Ignore { + @Test + public void testAllFilesPresentInIgnore() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings") + @TestDataPath("$PROJECT_ROOT") + public class NullabilityWarnings { + @Test + public void testAllFilesPresentInNullabilityWarnings() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("elvis.kt") + public void testElvis() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.kt"); + } + + @Test + @TestMetadata("localInference.kt") + public void testLocalInference() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.kt"); + } + + @Test + @TestMetadata("nullabilityGenerics.kt") + public void testNullabilityGenerics() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.kt"); + } + + @Test + @TestMetadata("nullabilityNicknames.kt") + public void testNullabilityNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.kt"); + } + + @Test + @TestMetadata("safeCalls.kt") + public void testSafeCalls() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt"); + } + + @Test + @TestMetadata("strange.kt") + public void testStrange() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes") + @TestDataPath("$PROJECT_ROOT") + public class FromPlatformTypes { + @Test + public void testAllFilesPresentInFromPlatformTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("arithmetic.kt") + public void testArithmetic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.kt"); + } + + @Test + @TestMetadata("array.kt") + public void testArray() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.kt"); + } + + @Test + @TestMetadata("assignToVar.kt") + public void testAssignToVar() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.kt"); + } + + @Test + @TestMetadata("conditions.kt") + public void testConditions() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.kt"); + } + + @Test + @TestMetadata("dataFlowInfo.kt") + public void testDataFlowInfo() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.kt"); + } + + @Test + @TestMetadata("defaultParameters.kt") + public void testDefaultParameters() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.kt"); + } + + @Test + @TestMetadata("delegatedProperties.kt") + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.kt"); + } + + @Test + @TestMetadata("delegation.kt") + public void testDelegation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.kt"); + } + + @Test + @TestMetadata("derefenceExtension.kt") + public void testDerefenceExtension() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.kt"); + } + + @Test + @TestMetadata("derefenceMember.kt") + public void testDerefenceMember() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.kt"); + } + + @Test + @TestMetadata("expectedType.kt") + public void testExpectedType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.kt"); + } + + @Test + @TestMetadata("for.kt") + public void testFor() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.kt"); + } + + @Test + @TestMetadata("functionArguments.kt") + public void testFunctionArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.kt"); + } + + @Test + @TestMetadata("invoke.kt") + public void testInvoke() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.kt"); + } + + @Test + @TestMetadata("kt6829.kt") + public void testKt6829() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.kt"); + } + + @Test + @TestMetadata("multiDeclaration.kt") + public void testMultiDeclaration() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.kt"); + } + + @Test + @TestMetadata("passToJava.kt") + public void testPassToJava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.kt"); + } + + @Test + @TestMetadata("primitiveArray.kt") + public void testPrimitiveArray() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.kt"); + } + + @Test + @TestMetadata("throw.kt") + public void testThrow() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.kt"); + } + + @Test + @TestMetadata("uselessElvisRightIsNull.kt") + public void testUselessElvisRightIsNull() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("equalsOnNonNull.kt") + public void testEqualsOnNonNull() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.kt"); + } + + @Test + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt"); + } + + @Test + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.kt"); + } + + @Test + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + } + + @Test + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.kt"); + } + + @Test + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt"); + } + + @Test + @TestMetadata("forceFlexibility.kt") + public void testForceFlexibility() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt"); + } + + @Test + @TestMetadata("forceFlexibleOverOverrides.kt") + public void testForceFlexibleOverOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.kt"); + } + + @Test + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt"); + } + + @Test + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + } + + @Test + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt"); + } + + @Test + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305NullabilityWarnings { + @Test + public void testAllFilesPresentInJsr305NullabilityWarnings() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration") + @TestDataPath("$PROJECT_ROOT") + public class Migration { + @Test + public void testAllFilesPresentInMigration() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("customMigration.kt") + public void testCustomMigration() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.kt"); + } + + @Test + @TestMetadata("globalIgnore.kt") + public void testGlobalIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.kt"); + } + + @Test + @TestMetadata("globalWarningMigrationIgnore.kt") + public void testGlobalWarningMigrationIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.kt"); + } + + @Test + @TestMetadata("migrationError.kt") + public void testMigrationError() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.kt"); + } + + @Test + @TestMetadata("migrationIgnore.kt") + public void testMigrationIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.kt"); + } + + @Test + @TestMetadata("migrationWarning.kt") + public void testMigrationWarning() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.kt"); + } + + @Test + @TestMetadata("overrideConflicts.kt") + public void testOverrideConflicts() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.kt"); + } + + @Test + @TestMetadata("specialCollision.kt") + public void testSpecialCollision() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.kt"); + } + + @Test + @TestMetadata("stateRefinement.kt") + public void testStateRefinement() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("defaultAndNicknameMigrationPolicy.kt") + public void testDefaultAndNicknameMigrationPolicy() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests") + @TestDataPath("$PROJECT_ROOT") + public class Java8Tests { + @Test + public void testAllFilesPresentInJava8Tests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("checkerFramework.kt") + public void testCheckerFramework() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt"); + } + + @Test + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt"); + } + + @Test + @TestMetadata("typeUseOnObject.kt") + public void testTypeUseOnObject() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify") + @TestDataPath("$PROJECT_ROOT") + public class Jspecify { + @Test + public void testAllFilesPresentInJspecify() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305 { + @Test + public void testAllFilesPresentInJsr305() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("defaultAnnotationAppliedToType.kt") + public void testDefaultAnnotationAppliedToType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt"); + } + + @Test + @TestMetadata("defaultAnnotationAppliedToTypeForCompiledJava.kt") + public void testDefaultAnnotationAppliedToTypeForCompiledJava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt"); + } + + @Test + @TestMetadata("springNullableWithTypeUse.kt") + public void testSpringNullableWithTypeUse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt"); + } + + @Test + @TestMetadata("typeArguments.kt") + public void testTypeArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.kt"); + } + + @Test + @TestMetadata("typeUseVsMethodConflict.kt") + public void testTypeUseVsMethodConflict() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc") + @TestDataPath("$PROJECT_ROOT") + public class Misc { + @Test + public void testAllFilesPresentInMisc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("annotatedTypeArguments.kt") + public void testAnnotatedTypeArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt"); + } + + @Test + @TestMetadata("classTypeParameterBound.kt") + public void testClassTypeParameterBound() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.kt"); + } + + @Test + @TestMetadata("classTypeParameterBoundWithWarnings.kt") + public void testClassTypeParameterBoundWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.kt"); + } + + @Test + @TestMetadata("enhancedRecursiveStarProjection.kt") + public void testEnhancedRecursiveStarProjection() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt"); + } + + @Test + @TestMetadata("methodWithTypeParameter.kt") + public void testMethodWithTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt"); + } + + @Test + @TestMetadata("notNullVarargsOverrides.kt") + public void testNotNullVarargsOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.kt"); + } + + @Test + @TestMetadata("nullableVarargsOverrides.kt") + public void testNullableVarargsOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.kt"); + } + + @Test + @TestMetadata("returnType.kt") + public void testReturnType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.kt"); + } + + @Test + @TestMetadata("returnTypeDifferentConstructor.kt") + public void testReturnTypeDifferentConstructor() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt"); + } + + @Test + @TestMetadata("returnTypeOverrideInKotlin.kt") + public void testReturnTypeOverrideInKotlin() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.kt"); + } + + @Test + @TestMetadata("returnTypeWithWarnings.kt") + public void testReturnTypeWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt"); + } + + @Test + @TestMetadata("useTypeParameterAnnotationToEnhanceItsUsages.kt") + public void testUseTypeParameterAnnotationToEnhanceItsUsages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.kt"); + } + + @Test + @TestMetadata("valueParameter.kt") + public void testValueParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.kt"); + } + + @Test + @TestMetadata("valueParameterWithWarnings.kt") + public void testValueParameterWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.kt"); + } + + @Test + @TestMetadata("warningsBasedOnEnhancedBasedType.kt") + public void testWarningsBasedOnEnhancedBasedType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests") + @TestDataPath("$PROJECT_ROOT") + public class Java9Tests { + @Test + public void testAllFilesPresentInJava9Tests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify") + @TestDataPath("$PROJECT_ROOT") + public class Jspecify { + @Test + public void testAllFilesPresentInJspecify() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } + } +} diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java new file mode 100644 index 00000000000..f6ed482471a --- /dev/null +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java @@ -0,0 +1,1129 @@ +/* + * Copyright 2010-2021 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 FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated extends AbstractFirForeignAnnotationsCompiledJavaWithPsiClassReadingTest { + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests") + @TestDataPath("$PROJECT_ROOT") + public class Tests { + @Test + public void testAllFilesPresentInTests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("androidRecently.kt") + public void testAndroidRecently() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.kt"); + } + + @Test + @TestMetadata("androidSdk.kt") + public void testAndroidSdk() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt"); + } + + @Test + @TestMetadata("android_support.kt") + public void testAndroid_support() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt"); + } + + @Test + @TestMetadata("androidx.kt") + public void testAndroidx() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt"); + } + + @Test + @TestMetadata("aosp.kt") + public void testAosp() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt"); + } + + @Test + @TestMetadata("checkerFramework.kt") + public void testCheckerFramework() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt"); + } + + @Test + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt"); + } + + @Test + @TestMetadata("findBugsSimple.kt") + public void testFindBugsSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt"); + } + + @Test + @TestMetadata("irrelevantQualifierNicknames.kt") + public void testIrrelevantQualifierNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt"); + } + + @Test + @TestMetadata("kt47833.kt") + public void testKt47833() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt"); + } + + @Test + @TestMetadata("kt47920.kt") + public void testKt47920() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt"); + } + + @Test + @TestMetadata("lombokSimple.kt") + public void testLombokSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt"); + } + + @Test + @TestMetadata("multiple.kt") + public void testMultiple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.kt"); + } + + @Test + @TestMetadata("rxjava.kt") + public void testRxjava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt"); + } + + @Test + @TestMetadata("rxjava3Default.kt") + public void testRxjava3Default() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.kt"); + } + + @Test + @TestMetadata("rxjava3Errors.kt") + public void testRxjava3Errors() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt"); + } + + @Test + @TestMetadata("rxjava3Ignore.kt") + public void testRxjava3Ignore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.kt"); + } + + @Test + @TestMetadata("rxjava3Warnings.kt") + public void testRxjava3Warnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305 { + @Test + public void testAllFilesPresentInJsr305() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("dontIgnoreAnnotationsWithoutTarget.kt") + public void testDontIgnoreAnnotationsWithoutTarget() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt"); + } + + @Test + @TestMetadata("nonNullNever.kt") + public void testNonNullNever() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt"); + } + + @Test + @TestMetadata("nullabilityNicknames.kt") + public void testNullabilityNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt"); + } + + @Test + @TestMetadata("strange.kt") + public void testStrange() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore") + @TestDataPath("$PROJECT_ROOT") + public class Ignore { + @Test + public void testAllFilesPresentInIgnore() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings") + @TestDataPath("$PROJECT_ROOT") + public class NullabilityWarnings { + @Test + public void testAllFilesPresentInNullabilityWarnings() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("elvis.kt") + public void testElvis() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.kt"); + } + + @Test + @TestMetadata("localInference.kt") + public void testLocalInference() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.kt"); + } + + @Test + @TestMetadata("nullabilityGenerics.kt") + public void testNullabilityGenerics() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.kt"); + } + + @Test + @TestMetadata("nullabilityNicknames.kt") + public void testNullabilityNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.kt"); + } + + @Test + @TestMetadata("safeCalls.kt") + public void testSafeCalls() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt"); + } + + @Test + @TestMetadata("strange.kt") + public void testStrange() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes") + @TestDataPath("$PROJECT_ROOT") + public class FromPlatformTypes { + @Test + public void testAllFilesPresentInFromPlatformTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("arithmetic.kt") + public void testArithmetic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.kt"); + } + + @Test + @TestMetadata("array.kt") + public void testArray() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.kt"); + } + + @Test + @TestMetadata("assignToVar.kt") + public void testAssignToVar() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.kt"); + } + + @Test + @TestMetadata("conditions.kt") + public void testConditions() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.kt"); + } + + @Test + @TestMetadata("dataFlowInfo.kt") + public void testDataFlowInfo() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.kt"); + } + + @Test + @TestMetadata("defaultParameters.kt") + public void testDefaultParameters() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.kt"); + } + + @Test + @TestMetadata("delegatedProperties.kt") + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.kt"); + } + + @Test + @TestMetadata("delegation.kt") + public void testDelegation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.kt"); + } + + @Test + @TestMetadata("derefenceExtension.kt") + public void testDerefenceExtension() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.kt"); + } + + @Test + @TestMetadata("derefenceMember.kt") + public void testDerefenceMember() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.kt"); + } + + @Test + @TestMetadata("expectedType.kt") + public void testExpectedType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.kt"); + } + + @Test + @TestMetadata("for.kt") + public void testFor() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.kt"); + } + + @Test + @TestMetadata("functionArguments.kt") + public void testFunctionArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.kt"); + } + + @Test + @TestMetadata("invoke.kt") + public void testInvoke() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.kt"); + } + + @Test + @TestMetadata("kt6829.kt") + public void testKt6829() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.kt"); + } + + @Test + @TestMetadata("multiDeclaration.kt") + public void testMultiDeclaration() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.kt"); + } + + @Test + @TestMetadata("passToJava.kt") + public void testPassToJava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.kt"); + } + + @Test + @TestMetadata("primitiveArray.kt") + public void testPrimitiveArray() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.kt"); + } + + @Test + @TestMetadata("throw.kt") + public void testThrow() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.kt"); + } + + @Test + @TestMetadata("uselessElvisRightIsNull.kt") + public void testUselessElvisRightIsNull() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("equalsOnNonNull.kt") + public void testEqualsOnNonNull() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.kt"); + } + + @Test + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt"); + } + + @Test + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.kt"); + } + + @Test + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + } + + @Test + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.kt"); + } + + @Test + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt"); + } + + @Test + @TestMetadata("forceFlexibility.kt") + public void testForceFlexibility() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt"); + } + + @Test + @TestMetadata("forceFlexibleOverOverrides.kt") + public void testForceFlexibleOverOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.kt"); + } + + @Test + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt"); + } + + @Test + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + } + + @Test + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt"); + } + + @Test + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305NullabilityWarnings { + @Test + public void testAllFilesPresentInJsr305NullabilityWarnings() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration") + @TestDataPath("$PROJECT_ROOT") + public class Migration { + @Test + public void testAllFilesPresentInMigration() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("customMigration.kt") + public void testCustomMigration() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.kt"); + } + + @Test + @TestMetadata("globalIgnore.kt") + public void testGlobalIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.kt"); + } + + @Test + @TestMetadata("globalWarningMigrationIgnore.kt") + public void testGlobalWarningMigrationIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.kt"); + } + + @Test + @TestMetadata("migrationError.kt") + public void testMigrationError() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.kt"); + } + + @Test + @TestMetadata("migrationIgnore.kt") + public void testMigrationIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.kt"); + } + + @Test + @TestMetadata("migrationWarning.kt") + public void testMigrationWarning() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.kt"); + } + + @Test + @TestMetadata("overrideConflicts.kt") + public void testOverrideConflicts() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.kt"); + } + + @Test + @TestMetadata("specialCollision.kt") + public void testSpecialCollision() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.kt"); + } + + @Test + @TestMetadata("stateRefinement.kt") + public void testStateRefinement() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("defaultAndNicknameMigrationPolicy.kt") + public void testDefaultAndNicknameMigrationPolicy() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests") + @TestDataPath("$PROJECT_ROOT") + public class Java8Tests { + @Test + public void testAllFilesPresentInJava8Tests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("checkerFramework.kt") + public void testCheckerFramework() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt"); + } + + @Test + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt"); + } + + @Test + @TestMetadata("typeUseOnObject.kt") + public void testTypeUseOnObject() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify") + @TestDataPath("$PROJECT_ROOT") + public class Jspecify { + @Test + public void testAllFilesPresentInJspecify() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305 { + @Test + public void testAllFilesPresentInJsr305() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("defaultAnnotationAppliedToType.kt") + public void testDefaultAnnotationAppliedToType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt"); + } + + @Test + @TestMetadata("defaultAnnotationAppliedToTypeForCompiledJava.kt") + public void testDefaultAnnotationAppliedToTypeForCompiledJava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt"); + } + + @Test + @TestMetadata("springNullableWithTypeUse.kt") + public void testSpringNullableWithTypeUse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt"); + } + + @Test + @TestMetadata("typeArguments.kt") + public void testTypeArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.kt"); + } + + @Test + @TestMetadata("typeUseVsMethodConflict.kt") + public void testTypeUseVsMethodConflict() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc") + @TestDataPath("$PROJECT_ROOT") + public class Misc { + @Test + public void testAllFilesPresentInMisc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("annotatedTypeArguments.kt") + public void testAnnotatedTypeArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt"); + } + + @Test + @TestMetadata("classTypeParameterBound.kt") + public void testClassTypeParameterBound() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.kt"); + } + + @Test + @TestMetadata("classTypeParameterBoundWithWarnings.kt") + public void testClassTypeParameterBoundWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.kt"); + } + + @Test + @TestMetadata("enhancedRecursiveStarProjection.kt") + public void testEnhancedRecursiveStarProjection() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt"); + } + + @Test + @TestMetadata("methodWithTypeParameter.kt") + public void testMethodWithTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt"); + } + + @Test + @TestMetadata("notNullVarargsOverrides.kt") + public void testNotNullVarargsOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.kt"); + } + + @Test + @TestMetadata("nullableVarargsOverrides.kt") + public void testNullableVarargsOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.kt"); + } + + @Test + @TestMetadata("returnType.kt") + public void testReturnType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.kt"); + } + + @Test + @TestMetadata("returnTypeDifferentConstructor.kt") + public void testReturnTypeDifferentConstructor() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt"); + } + + @Test + @TestMetadata("returnTypeOverrideInKotlin.kt") + public void testReturnTypeOverrideInKotlin() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.kt"); + } + + @Test + @TestMetadata("returnTypeWithWarnings.kt") + public void testReturnTypeWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt"); + } + + @Test + @TestMetadata("useTypeParameterAnnotationToEnhanceItsUsages.kt") + public void testUseTypeParameterAnnotationToEnhanceItsUsages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.kt"); + } + + @Test + @TestMetadata("valueParameter.kt") + public void testValueParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.kt"); + } + + @Test + @TestMetadata("valueParameterWithWarnings.kt") + public void testValueParameterWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.kt"); + } + + @Test + @TestMetadata("warningsBasedOnEnhancedBasedType.kt") + public void testWarningsBasedOnEnhancedBasedType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests") + @TestDataPath("$PROJECT_ROOT") + public class Java9Tests { + @Test + public void testAllFilesPresentInJava9Tests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify") + @TestDataPath("$PROJECT_ROOT") + public class Jspecify { + @Test + public void testAllFilesPresentInJspecify() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } + } +} diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsSourceJavaTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsSourceJavaTestGenerated.java new file mode 100644 index 00000000000..6ffe1d6f903 --- /dev/null +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendForeignAnnotationsSourceJavaTestGenerated.java @@ -0,0 +1,1129 @@ +/* + * Copyright 2010-2021 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 FirOldFrontendForeignAnnotationsSourceJavaTestGenerated extends AbstractFirForeignAnnotationsSourceJavaTest { + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests") + @TestDataPath("$PROJECT_ROOT") + public class Tests { + @Test + public void testAllFilesPresentInTests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("androidRecently.kt") + public void testAndroidRecently() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.kt"); + } + + @Test + @TestMetadata("androidSdk.kt") + public void testAndroidSdk() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt"); + } + + @Test + @TestMetadata("android_support.kt") + public void testAndroid_support() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt"); + } + + @Test + @TestMetadata("androidx.kt") + public void testAndroidx() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt"); + } + + @Test + @TestMetadata("aosp.kt") + public void testAosp() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt"); + } + + @Test + @TestMetadata("checkerFramework.kt") + public void testCheckerFramework() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt"); + } + + @Test + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt"); + } + + @Test + @TestMetadata("findBugsSimple.kt") + public void testFindBugsSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt"); + } + + @Test + @TestMetadata("irrelevantQualifierNicknames.kt") + public void testIrrelevantQualifierNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt"); + } + + @Test + @TestMetadata("kt47833.kt") + public void testKt47833() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt"); + } + + @Test + @TestMetadata("kt47920.kt") + public void testKt47920() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt"); + } + + @Test + @TestMetadata("lombokSimple.kt") + public void testLombokSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt"); + } + + @Test + @TestMetadata("multiple.kt") + public void testMultiple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.kt"); + } + + @Test + @TestMetadata("rxjava.kt") + public void testRxjava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt"); + } + + @Test + @TestMetadata("rxjava3Default.kt") + public void testRxjava3Default() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.kt"); + } + + @Test + @TestMetadata("rxjava3Errors.kt") + public void testRxjava3Errors() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt"); + } + + @Test + @TestMetadata("rxjava3Ignore.kt") + public void testRxjava3Ignore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.kt"); + } + + @Test + @TestMetadata("rxjava3Warnings.kt") + public void testRxjava3Warnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305 { + @Test + public void testAllFilesPresentInJsr305() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("dontIgnoreAnnotationsWithoutTarget.kt") + public void testDontIgnoreAnnotationsWithoutTarget() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt"); + } + + @Test + @TestMetadata("nonNullNever.kt") + public void testNonNullNever() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt"); + } + + @Test + @TestMetadata("nullabilityNicknames.kt") + public void testNullabilityNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt"); + } + + @Test + @TestMetadata("strange.kt") + public void testStrange() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore") + @TestDataPath("$PROJECT_ROOT") + public class Ignore { + @Test + public void testAllFilesPresentInIgnore() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings") + @TestDataPath("$PROJECT_ROOT") + public class NullabilityWarnings { + @Test + public void testAllFilesPresentInNullabilityWarnings() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("elvis.kt") + public void testElvis() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.kt"); + } + + @Test + @TestMetadata("localInference.kt") + public void testLocalInference() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.kt"); + } + + @Test + @TestMetadata("nullabilityGenerics.kt") + public void testNullabilityGenerics() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.kt"); + } + + @Test + @TestMetadata("nullabilityNicknames.kt") + public void testNullabilityNicknames() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.kt"); + } + + @Test + @TestMetadata("safeCalls.kt") + public void testSafeCalls() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt"); + } + + @Test + @TestMetadata("strange.kt") + public void testStrange() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes") + @TestDataPath("$PROJECT_ROOT") + public class FromPlatformTypes { + @Test + public void testAllFilesPresentInFromPlatformTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("arithmetic.kt") + public void testArithmetic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.kt"); + } + + @Test + @TestMetadata("array.kt") + public void testArray() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.kt"); + } + + @Test + @TestMetadata("assignToVar.kt") + public void testAssignToVar() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.kt"); + } + + @Test + @TestMetadata("conditions.kt") + public void testConditions() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.kt"); + } + + @Test + @TestMetadata("dataFlowInfo.kt") + public void testDataFlowInfo() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.kt"); + } + + @Test + @TestMetadata("defaultParameters.kt") + public void testDefaultParameters() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.kt"); + } + + @Test + @TestMetadata("delegatedProperties.kt") + public void testDelegatedProperties() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.kt"); + } + + @Test + @TestMetadata("delegation.kt") + public void testDelegation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.kt"); + } + + @Test + @TestMetadata("derefenceExtension.kt") + public void testDerefenceExtension() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.kt"); + } + + @Test + @TestMetadata("derefenceMember.kt") + public void testDerefenceMember() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.kt"); + } + + @Test + @TestMetadata("expectedType.kt") + public void testExpectedType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.kt"); + } + + @Test + @TestMetadata("for.kt") + public void testFor() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.kt"); + } + + @Test + @TestMetadata("functionArguments.kt") + public void testFunctionArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.kt"); + } + + @Test + @TestMetadata("invoke.kt") + public void testInvoke() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.kt"); + } + + @Test + @TestMetadata("kt6829.kt") + public void testKt6829() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.kt"); + } + + @Test + @TestMetadata("multiDeclaration.kt") + public void testMultiDeclaration() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.kt"); + } + + @Test + @TestMetadata("passToJava.kt") + public void testPassToJava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.kt"); + } + + @Test + @TestMetadata("primitiveArray.kt") + public void testPrimitiveArray() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.kt"); + } + + @Test + @TestMetadata("throw.kt") + public void testThrow() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.kt"); + } + + @Test + @TestMetadata("uselessElvisRightIsNull.kt") + public void testUselessElvisRightIsNull() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("equalsOnNonNull.kt") + public void testEqualsOnNonNull() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.kt"); + } + + @Test + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt"); + } + + @Test + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.kt"); + } + + @Test + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + } + + @Test + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.kt"); + } + + @Test + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt"); + } + + @Test + @TestMetadata("forceFlexibility.kt") + public void testForceFlexibility() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt"); + } + + @Test + @TestMetadata("forceFlexibleOverOverrides.kt") + public void testForceFlexibleOverOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.kt"); + } + + @Test + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt"); + } + + @Test + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + } + + @Test + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + } + + @Test + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt"); + } + + @Test + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305NullabilityWarnings { + @Test + public void testAllFilesPresentInJsr305NullabilityWarnings() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration") + @TestDataPath("$PROJECT_ROOT") + public class Migration { + @Test + public void testAllFilesPresentInMigration() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("customMigration.kt") + public void testCustomMigration() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.kt"); + } + + @Test + @TestMetadata("globalIgnore.kt") + public void testGlobalIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.kt"); + } + + @Test + @TestMetadata("globalWarningMigrationIgnore.kt") + public void testGlobalWarningMigrationIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.kt"); + } + + @Test + @TestMetadata("migrationError.kt") + public void testMigrationError() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.kt"); + } + + @Test + @TestMetadata("migrationIgnore.kt") + public void testMigrationIgnore() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.kt"); + } + + @Test + @TestMetadata("migrationWarning.kt") + public void testMigrationWarning() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.kt"); + } + + @Test + @TestMetadata("overrideConflicts.kt") + public void testOverrideConflicts() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.kt"); + } + + @Test + @TestMetadata("specialCollision.kt") + public void testSpecialCollision() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.kt"); + } + + @Test + @TestMetadata("stateRefinement.kt") + public void testStateRefinement() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + public class TypeQualifierDefault { + @Test + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("defaultAndNicknameMigrationPolicy.kt") + public void testDefaultAndNicknameMigrationPolicy() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests") + @TestDataPath("$PROJECT_ROOT") + public class Java8Tests { + @Test + public void testAllFilesPresentInJava8Tests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("checkerFramework.kt") + public void testCheckerFramework() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt"); + } + + @Test + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt"); + } + + @Test + @TestMetadata("typeUseOnObject.kt") + public void testTypeUseOnObject() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify") + @TestDataPath("$PROJECT_ROOT") + public class Jspecify { + @Test + public void testAllFilesPresentInJspecify() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") + @TestDataPath("$PROJECT_ROOT") + public class Jsr305 { + @Test + public void testAllFilesPresentInJsr305() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("defaultAnnotationAppliedToType.kt") + public void testDefaultAnnotationAppliedToType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt"); + } + + @Test + @TestMetadata("defaultAnnotationAppliedToTypeForCompiledJava.kt") + public void testDefaultAnnotationAppliedToTypeForCompiledJava() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt"); + } + + @Test + @TestMetadata("springNullableWithTypeUse.kt") + public void testSpringNullableWithTypeUse() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt"); + } + + @Test + @TestMetadata("typeArguments.kt") + public void testTypeArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.kt"); + } + + @Test + @TestMetadata("typeUseVsMethodConflict.kt") + public void testTypeUseVsMethodConflict() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc") + @TestDataPath("$PROJECT_ROOT") + public class Misc { + @Test + public void testAllFilesPresentInMisc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("annotatedTypeArguments.kt") + public void testAnnotatedTypeArguments() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt"); + } + + @Test + @TestMetadata("classTypeParameterBound.kt") + public void testClassTypeParameterBound() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.kt"); + } + + @Test + @TestMetadata("classTypeParameterBoundWithWarnings.kt") + public void testClassTypeParameterBoundWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.kt"); + } + + @Test + @TestMetadata("enhancedRecursiveStarProjection.kt") + public void testEnhancedRecursiveStarProjection() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt"); + } + + @Test + @TestMetadata("methodWithTypeParameter.kt") + public void testMethodWithTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt"); + } + + @Test + @TestMetadata("notNullVarargsOverrides.kt") + public void testNotNullVarargsOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.kt"); + } + + @Test + @TestMetadata("nullableVarargsOverrides.kt") + public void testNullableVarargsOverrides() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.kt"); + } + + @Test + @TestMetadata("returnType.kt") + public void testReturnType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.kt"); + } + + @Test + @TestMetadata("returnTypeDifferentConstructor.kt") + public void testReturnTypeDifferentConstructor() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt"); + } + + @Test + @TestMetadata("returnTypeOverrideInKotlin.kt") + public void testReturnTypeOverrideInKotlin() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.kt"); + } + + @Test + @TestMetadata("returnTypeWithWarnings.kt") + public void testReturnTypeWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt"); + } + + @Test + @TestMetadata("useTypeParameterAnnotationToEnhanceItsUsages.kt") + public void testUseTypeParameterAnnotationToEnhanceItsUsages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.kt"); + } + + @Test + @TestMetadata("valueParameter.kt") + public void testValueParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.kt"); + } + + @Test + @TestMetadata("valueParameterWithWarnings.kt") + public void testValueParameterWithWarnings() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.kt"); + } + + @Test + @TestMetadata("warningsBasedOnEnhancedBasedType.kt") + public void testWarningsBasedOnEnhancedBasedType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.kt"); + } + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests") + @TestDataPath("$PROJECT_ROOT") + public class Java9Tests { + @Test + public void testAllFilesPresentInJava9Tests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify") + @TestDataPath("$PROJECT_ROOT") + public class Jspecify { + @Test + public void testAllFilesPresentInJspecify() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt index 866a4defba3..888b7f671c4 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/checkerFramework.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SOURCE_RETENTION_ANNOTATIONS // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt index 63c216a65d2..51b4904cf5c 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SOURCE_RETENTION_ANNOTATIONS // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.fir.kt new file mode 100644 index 00000000000..685a6497713 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/AnnotatedBoundsOfWildcard.fir.kt @@ -0,0 +1,81 @@ +// JSPECIFY_STATE: strict +// MUTE_FOR_PSI_CLASS_FILES_READING +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: AnnotatedBoundsOfWildcard.java +import org.jspecify.nullness.*; + +@NullMarked +public class AnnotatedBoundsOfWildcard { + public void superAsIs(Test a) {} + public void superNotNull(Test a) {} + public void superNullable(Test a) {} + + public void extendsAsIs(Test a) {} + public void extendsNotNull(Test a) {} + public void extendsNullable(Test a) {} + + public void noBounds(Test a) {} +} + +// FILE: Base.java +public class Base {} + +// FILE: Derived.java +public class Derived extends Base {} + +// FILE: Test.java +import org.jspecify.nullness.*; + +@NullMarked +public class Test { } + +// FILE: main.kt +fun main( + aNotNullNotNullNotNull: Test, + aNotNullNotNullNull: Test, + aNotNullNullNotNull: Test, + aNotNullNullNull: Test, + + aAnyNotNullNotNullNotNull: Test, + aAnyNotNullNotNullNull: Test, + aAnyNotNullNullNotNull: Test, + aAnyNotNullNullNull: Test, + + b: AnnotatedBoundsOfWildcard +): Unit { + b.superAsIs(aAnyNotNullNotNullNotNull) + b.superAsIs(aAnyNotNullNotNullNull) + b.superAsIs(aAnyNotNullNullNotNull) + b.superAsIs(aAnyNotNullNullNull) + + b.superNotNull(aAnyNotNullNotNullNotNull) + b.superNotNull(aAnyNotNullNotNullNull) + b.superNotNull(aAnyNotNullNullNotNull) + b.superNotNull(aAnyNotNullNullNull) + + b.superNullable(aAnyNotNullNotNullNotNull) + b.superNullable(aAnyNotNullNotNullNull) + b.superNullable(aAnyNotNullNullNotNull) + b.superNullable(aAnyNotNullNullNull) + + b.extendsAsIs(aNotNullNotNullNotNull) + b.extendsAsIs(aNotNullNotNullNull) + b.extendsAsIs(aNotNullNullNotNull) + b.extendsAsIs(aNotNullNullNull) + + b.extendsNotNull(aNotNullNotNullNotNull) + b.extendsNotNull(aNotNullNotNullNull) + b.extendsNotNull(aNotNullNullNotNull) + b.extendsNotNull(aNotNullNullNull) + + b.extendsNullable(aNotNullNotNullNotNull) + b.extendsNullable(aNotNullNotNullNull) + b.extendsNullable(aNotNullNullNotNull) + b.extendsNullable(aNotNullNullNull) + + b.noBounds(aNotNullNotNullNotNull) + b.noBounds(aNotNullNotNullNull) + b.noBounds(aNotNullNullNotNull) + b.noBounds(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt index cc6a973addf..f0aa0bebf42 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Captured.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: strict // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode // FILE: J1.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt new file mode 100644 index 00000000000..86e07ef317a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt @@ -0,0 +1,46 @@ +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: Defaults.java +import org.jspecify.nullness.*; + +@NullMarked +public class Defaults { + public Foo defaultField = null; + @Nullable public Foo field = null; + + public Foo everythingNotNullable(Foo x) { return null; } + + public @Nullable Foo everythingNullable(@Nullable Foo x) { return null; } + + public @NullnessUnspecified Foo everythingUnknown(@NullnessUnspecified Foo x) { return null; } + + public @Nullable Foo mixed(Foo x) { return null; } + + public Foo explicitlyNullnessUnspecified(@NullnessUnspecified Foo x) { return null; } +} + +// FILE: Foo.java +public class Foo { + public Object foo() { return null; } +} + +// FILE: main.kt +fun main(a: Defaults, x: Foo): Unit { + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() + + a.mixed(null).foo() + a.mixed(x).foo() + + a.explicitlyNullnessUnspecified(x).foo() + a.explicitlyNullnessUnspecified(null).foo() + + a.defaultField.foo() + + a.field.foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt new file mode 100644 index 00000000000..0718769a3b8 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt @@ -0,0 +1,44 @@ +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: IgnoreAnnotations.java +import org.jspecify.nullness.*; + +@NullMarked +public class IgnoreAnnotations { + @Nullable public Derived field = null; + + @Nullable + public Derived foo(Derived x, @NullnessUnspecified Base y) { + return null; + } + + public Derived everythingNotNullable(Derived x) { return null; } + + public @Nullable Derived everythingNullable(@Nullable Derived x) { return null; } + + public @NullnessUnspecified Derived everythingUnknown(@NullnessUnspecified Derived x) { return null; } +} + +// FILE: Base.java +public class Base { + void foo() {} +} + +// FILE: Derived.java +public class Derived extends Base { } + +// FILE: main.kt +fun main(a: IgnoreAnnotations, x: Derived): Unit { + a.foo(x, null).foo() + a.foo(null, x).foo() + + a.field.foo() + + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.fir.kt new file mode 100644 index 00000000000..1ded9006c78 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.fir.kt @@ -0,0 +1,27 @@ +// !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +TypeEnhancementImprovementsInStrictMode +// JSPECIFY_STATE: strict +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: NonPlatformTypeParameter.java +import org.jspecify.nullness.*; + +public class NonPlatformTypeParameter { + public void foo(T t) {} + public void bar(E e) {} +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main(a1: NonPlatformTypeParameter, a2: NonPlatformTypeParameter, x: T): Unit { + a1.foo(null) + a1.bar(null) + a1.bar(null) + a1.bar(x) + + a2.foo(null) + a2.bar(null) + a2.bar(null) + a2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt new file mode 100644 index 00000000000..a2e0610a9d4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt @@ -0,0 +1,31 @@ +// JSPECIFY_STATE: strict + +// FILE: NullnessUnspecifiedTypeParameter.java +import org.jspecify.nullness.*; + +@NullMarked +public class NullnessUnspecifiedTypeParameter { + public void foo(T t) {} + + public void bar(Test s, T t) {} // t should not become not nullable +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter, x: Test): Unit { + a1.foo(null) + a1.foo(1) + + a2.foo(null) + a2.foo(1) + + a1.bar(null, null) + a1.bar(x, null) + a1.bar(x, 1) + + a2.bar(null, null) + a2.bar(x, null) + a2.bar(x, 1) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt new file mode 100644 index 00000000000..c9539f4bf08 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt @@ -0,0 +1,53 @@ +// JSPECIFY_STATE: strict + +// FILE: SelfType.java +import org.jspecify.nullness.*; + +@NullMarked +public class SelfType> { + public void foo(T t) {} +} + +// FILE: B.java +public class B extends SelfType {} + +// FILE: C.java +import org.jspecify.nullness.*; + +@NullMarked +public class C> extends SelfType {} + +// FILE: AK.java +public class AK extends SelfType {} + +// FILE: AKN.java +import org.jspecify.nullness.*; + +public class AKN extends SelfType<@Nullable AK> {} + +// FILE: BK.java +public class BK extends B {} + +// FILE: CK.java +public class CK extends C {} + +// FILE: CKN.java +import org.jspecify.nullness.*; + +public class CKN extends C<@Nullable CK> {} + +// FILE: main.kt +fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit { + ak.foo(ak) + ak.foo(null) + + akn.foo(null) + + bk.foo(bk) + bk.foo(null) + + ck.foo(ck) + ck.foo(null) + + ckn.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt new file mode 100644 index 00000000000..028682e0287 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt @@ -0,0 +1,37 @@ +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: Simple.java +import org.jspecify.nullness.*; + +@NullMarked +public class Simple { + @Nullable public Derived field = null; + + @Nullable + public Derived foo(Derived x, @NullnessUnspecified Base y) { + return null; + } + + public Derived bar() { + return null; + } +} + +// FILE: Base.java +public class Base {} + +// FILE: Derived.java +public class Derived extends Base { + void foo() {} +} + +// FILE: main.kt +fun main(a: Simple, x: Derived): Unit { + a.foo(x, null).foo() + a.foo(null, x).foo() + + a.bar().foo() + + a.field.foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt new file mode 100644 index 00000000000..367476c1f44 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt @@ -0,0 +1,46 @@ +// JSPECIFY_STATE: strict +// MUTE_FOR_PSI_CLASS_FILES_READING +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: TypeArgumentsFromParameterBounds.java +import org.jspecify.nullness.*; + +@NullMarked +public class TypeArgumentsFromParameterBounds {} + +// FILE: A.java +import org.jspecify.nullness.*; + +@NullMarked +public class A { + public void bar(TypeArgumentsFromParameterBounds a) {} +} + +// FILE: B.java +import org.jspecify.nullness.*; + +public class B { + public void bar(TypeArgumentsFromParameterBounds a) {} +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main( + aNotNullNotNullNotNull: TypeArgumentsFromParameterBounds, + aNotNullNotNullNull: TypeArgumentsFromParameterBounds, + aNotNullNullNotNull: TypeArgumentsFromParameterBounds, + aNotNullNullNull: TypeArgumentsFromParameterBounds, + a: A, b: B +): Unit { + a.bar(aNotNullNotNullNotNull) + a.bar(aNotNullNotNullNull) + a.bar(aNotNullNullNotNull) + a.bar(aNotNullNullNull) + + b.bar(aNotNullNotNullNotNull) + b.bar(aNotNullNotNullNull) + b.bar(aNotNullNullNotNull) + b.bar(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt new file mode 100644 index 00000000000..ea635134774 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt @@ -0,0 +1,40 @@ +// JSPECIFY_STATE: strict + +// FILE: A.java +import org.jspecify.nullness.*; + +@NullMarked +public class A { + public void foo(@NullnessUnspecified T t) {} + public void bar(E e) {} +} + +// FILE: B.java +import org.jspecify.nullness.*; +@NullMarked +public class B { + public void foo(T t) {} + public void bar(E e) {} +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main(a1: A, a2: A, b1: B, b2: B, x: T): Unit { + a1.foo(null) + a1.bar(null) + a1.bar(x) + + a2.foo(null) + a2.bar(null) + a2.bar(x) + + b1.foo(null) + b1.bar(null) + b1.bar(x) + + b2.foo(null) + b2.bar(null) + b2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.fir.kt new file mode 100644 index 00000000000..8dd33227973 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/WildcardsWithDefault.fir.kt @@ -0,0 +1,35 @@ +// JSPECIFY_STATE: strict +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: WildcardsWithDefault.java +import org.jspecify.nullness.*; + +@NullMarked +public class WildcardsWithDefault { + public void noBoundsNotNull(A a) {} + public void noBoundsNullable(A a) {} +} + +// FILE: A.java +import org.jspecify.nullness.*; + +public class A {} + +// FILE: main.kt +fun main( + aNotNullNotNullNotNull: A, + aNotNullNotNullNull: A, + aNotNullNullNotNull: A, + aNotNullNullNull: A, + b: WildcardsWithDefault +): Unit { + b.noBoundsNotNull(aNotNullNotNullNotNull) + b.noBoundsNotNull(aNotNullNotNullNull) + b.noBoundsNotNull(aNotNullNullNotNull) + b.noBoundsNotNull(aNotNullNullNull) + + b.noBoundsNullable(aNotNullNotNullNotNull) + b.noBoundsNullable(aNotNullNotNullNull) + b.noBoundsNullable(aNotNullNullNotNull) + b.noBoundsNullable(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt index 24ca4c007f9..e5734067dad 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47396.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: strict // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode // MUTE_FOR_PSI_CLASS_FILES_READING diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.fir.kt new file mode 100644 index 00000000000..a59267ef2c9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47422.fir.kt @@ -0,0 +1,135 @@ +// JSPECIFY_STATE: strict +// !DIAGNOSTICS: -UNUSED_PARAMETER +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: Foo.java +import org.jspecify.nullness.*; + +public interface Foo {} + +// FILE: Util.java +public class Util { + public static Foo getFooOfString() { + throw new RuntimeException(); + } +} + +// FILE: UtilNullMarked.java +import org.jspecify.nullness.*; + +@NullMarked +public class UtilNullMarked { + public static Foo getFooOfString() { + throw new RuntimeException(); + } +} + +// FILE: UtilNullMarkedGeneric.java +import org.jspecify.nullness.*; + +@NullMarked +public class UtilNullMarkedGeneric { + public static Foo getFooOfK() { + throw new RuntimeException(); + } +} + +// FILE: UtilNullMarkedGenericNullableBound.java +import org.jspecify.nullness.*; + +@NullMarked +public class UtilNullMarkedGenericNullableBound { + public static Foo getFooOfK() { + throw new RuntimeException(); + } +} + +// FILE: UtilGenericNullableBound.java +import org.jspecify.nullness.*; + +public class UtilGenericNullableBound { + public static Foo getFooOfK() { + throw new RuntimeException(); + } +} + +// FILE: UtilNullMarkedGenericNullnessUnspecifiedBound.java +import org.jspecify.nullness.*; + +@NullMarked +public class UtilNullMarkedGenericNullnessUnspecifiedBound { + public static Foo getFooOfK() { + throw new RuntimeException(); + } +} + +// FILE: UtilGenericNullnessUnspecifiedBound.java +import org.jspecify.nullness.*; + +public class UtilGenericNullnessUnspecifiedBound { + public static Foo getFooOfK() { + throw new RuntimeException(); + } +} + +// FILE: main.kt + +// no errors on this call means String in Foo is flexible +fun isNotNullAndNullableStringInFoo(x: Foo, y: Foo) {} + +fun test1() { + // String in Foo is flexible + isNotNullAndNullableStringInFoo( + Util.getFooOfString(), + Util.getFooOfString() + ) +} + +fun test2() { + // String in Foo is not null + isNotNullAndNullableStringInFoo( + UtilNullMarked.getFooOfString(), + UtilNullMarked.getFooOfString() + ) +} + +fun test3() { + // String in Foo is not null + isNotNullAndNullableStringInFoo( + UtilNullMarkedGeneric.getFooOfK(), + UtilNullMarkedGeneric.getFooOfK() + ) +} + +fun test4() { + // String in Foo is flexible + isNotNullAndNullableStringInFoo( + UtilNullMarkedGenericNullableBound.getFooOfK(), + UtilNullMarkedGenericNullableBound.getFooOfK() + ) +} + +fun test5() { + // String in Foo is flexible + isNotNullAndNullableStringInFoo( + UtilGenericNullableBound.getFooOfK(), + UtilGenericNullableBound.getFooOfK() + ) +} + +fun test6() { + // String in Foo is flexible + isNotNullAndNullableStringInFoo( + UtilNullMarkedGenericNullnessUnspecifiedBound.getFooOfK(), + UtilNullMarkedGenericNullnessUnspecifiedBound.getFooOfK() + ) +} + +fun test7() { + // String in Foo is flexible + isNotNullAndNullableStringInFoo( + UtilGenericNullnessUnspecifiedBound.getFooOfK(), + UtilGenericNullnessUnspecifiedBound.getFooOfK() + ) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.fir.kt new file mode 100644 index 00000000000..9a9231a4cdb --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/kt47437.fir.kt @@ -0,0 +1,18 @@ +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: Foo.java +import org.jspecify.nullness.*; + +@NullMarked +public class Foo { + static Foo create() { + return new Foo<>(); + } +} + +// FILE: main.kt +fun test(): Foo { + return ")!>Foo.create() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.fir.kt new file mode 100644 index 00000000000..fb11c5e00c1 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/AnnotatedBoundsOfWildcard.fir.kt @@ -0,0 +1,80 @@ +// JSPECIFY_STATE: warn +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: AnnotatedBoundsOfWildcard.java +import org.jspecify.nullness.*; + +@NullMarked +public class AnnotatedBoundsOfWildcard { + public void superAsIs(Test a) {} + public void superNotNull(Test a) {} + public void superNullable(Test a) {} + + public void extendsAsIs(Test a) {} + public void extendsNotNull(Test a) {} + public void extendsNullable(Test a) {} + + public void noBounds(Test a) {} +} + +// FILE: Base.java +public class Base {} + +// FILE: Derived.java +public class Derived extends Base {} + +// FILE: Test.java +import org.jspecify.nullness.*; + +@NullMarked +public class Test { } + +// FILE: main.kt +fun main( + aNotNullNotNullNotNull: Test, + aNotNullNotNullNull: Test, + aNotNullNullNotNull: Test, + aNotNullNullNull: Test, + + aAnyNotNullNotNullNotNull: Test, + aAnyNotNullNotNullNull: Test, + aAnyNotNullNullNotNull: Test, + aAnyNotNullNullNull: Test, + + b: AnnotatedBoundsOfWildcard +): Unit { + b.superAsIs(aAnyNotNullNotNullNotNull) + b.superAsIs(aAnyNotNullNotNullNull) + b.superAsIs(aAnyNotNullNullNotNull) + b.superAsIs(aAnyNotNullNullNull) + + b.superNotNull(aAnyNotNullNotNullNotNull) + b.superNotNull(aAnyNotNullNotNullNull) + b.superNotNull(aAnyNotNullNullNotNull) + b.superNotNull(aAnyNotNullNullNull) + + b.superNullable(aAnyNotNullNotNullNotNull) + b.superNullable(aAnyNotNullNotNullNull) + b.superNullable(aAnyNotNullNullNotNull) + b.superNullable(aAnyNotNullNullNull) + + b.extendsAsIs(aNotNullNotNullNotNull) + b.extendsAsIs(aNotNullNotNullNull) + b.extendsAsIs(aNotNullNullNotNull) + b.extendsAsIs(aNotNullNullNull) + + b.extendsNotNull(aNotNullNotNullNotNull) + b.extendsNotNull(aNotNullNotNullNull) + b.extendsNotNull(aNotNullNullNotNull) + b.extendsNotNull(aNotNullNullNull) + + b.extendsNullable(aNotNullNotNullNotNull) + b.extendsNullable(aNotNullNotNullNull) + b.extendsNullable(aNotNullNullNotNull) + b.extendsNullable(aNotNullNullNull) + + b.noBounds(aNotNullNotNullNotNull) + b.noBounds(aNotNullNotNullNull) + b.noBounds(aNotNullNullNotNull) + b.noBounds(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt index aac2c7c41f7..df2c1439af4 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Captured.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: warn // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode // FILE: J1.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.fir.kt new file mode 100644 index 00000000000..090db16ba6b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Defaults.fir.kt @@ -0,0 +1,45 @@ +// JSPECIFY_STATE: warn + +// FILE: Defaults.java +import org.jspecify.nullness.*; + +@NullMarked +public class Defaults { + public Foo defaultField = null; + @Nullable public Foo field = null; + + public Foo everythingNotNullable(Foo x) { return null; } + + public @Nullable Foo everythingNullable(@Nullable Foo x) { return null; } + + public @NullnessUnspecified Foo everythingUnknown(@NullnessUnspecified Foo x) { return null; } + + public @Nullable Foo mixed(Foo x) { return null; } + + public Foo explicitlyNullnessUnspecified(@NullnessUnspecified Foo x) { return null; } +} + +// FILE: Foo.java +public class Foo { + public Object foo() { return null; } +} + +// FILE: main.kt +fun main(a: Defaults, x: Foo): Unit { + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() + + a.mixed(null).foo() + a.mixed(x).foo() + + a.explicitlyNullnessUnspecified(x).foo() + a.explicitlyNullnessUnspecified(null).foo() + + a.defaultField.foo() + + a.field.foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.fir.kt new file mode 100644 index 00000000000..c49f4d4532c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/IgnoreAnnotations.fir.kt @@ -0,0 +1,43 @@ +// JSPECIFY_STATE: warn + +// FILE: IgnoreAnnotations.java +import org.jspecify.nullness.*; + +@NullMarked +public class IgnoreAnnotations { + @Nullable public Derived field = null; + + @Nullable + public Derived foo(Derived x, @NullnessUnspecified Base y) { + return null; + } + + public Derived everythingNotNullable(Derived x) { return null; } + + public @Nullable Derived everythingNullable(@Nullable Derived x) { return null; } + + public @NullnessUnspecified Derived everythingUnknown(@NullnessUnspecified Derived x) { return null; } +} + +// FILE: Base.java +public class Base { + void foo() {} +} + +// FILE: Derived.java +public class Derived extends Base { } + +// FILE: main.kt +fun main(a: IgnoreAnnotations, x: Derived): Unit { + a.foo(x, null).foo() + a.foo(null, x).foo() + + a.field.foo() + + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.fir.kt new file mode 100644 index 00000000000..c07db7b6b46 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.fir.kt @@ -0,0 +1,27 @@ +// JSPECIFY_STATE: warn +// !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: NonPlatformTypeParameter.java +import org.jspecify.nullness.*; + +public class NonPlatformTypeParameter { + public void foo(T t) {} + public void bar(E e) {} +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main(a1: NonPlatformTypeParameter, a2: NonPlatformTypeParameter, x: T): Unit { + a1.foo(null) + a1.bar(null) + a1.bar(null) + a1.bar(x) + + a2.foo(null) + a2.bar(null) + a2.bar(null) + a2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.fir.kt new file mode 100644 index 00000000000..4115abef0d6 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullnessUnspecifiedTypeParameter.fir.kt @@ -0,0 +1,30 @@ +// JSPECIFY_STATE: warn +// FILE: NullnessUnspecifiedTypeParameter.java +import org.jspecify.nullness.*; + +@NullMarked +public class NullnessUnspecifiedTypeParameter { + public void foo(T t) {} + + public void bar(Test s, T t) {} // t should not become not nullable +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter, x: Test): Unit { + a1.foo(null) + a1.foo(1) + + a2.foo(null) + a2.foo(1) + + a1.bar(null, null) + a1.bar(x, null) + a1.bar(x, 1) + + a2.bar(null, null) + a2.bar(x, null) + a2.bar(x, 1) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.fir.kt new file mode 100644 index 00000000000..3d42425409d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/SelfType.fir.kt @@ -0,0 +1,54 @@ +// JSPECIFY_STATE: warn +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: SelfType.java +import org.jspecify.nullness.*; + +@NullMarked +public class SelfType> { + public void foo(T t) {} +} + +// FILE: B.java +public class B extends SelfType {} + +// FILE: C.java +import org.jspecify.nullness.*; + +@NullMarked +public class C> extends SelfType {} + +// FILE: AK.java +public class AK extends SelfType {} + +// FILE: AKN.java +import org.jspecify.nullness.*; + +public class AKN extends SelfType<@Nullable AK> {} + +// FILE: BK.java +public class BK extends B {} + +// FILE: CK.java +public class CK extends C {} + +// FILE: CKN.java +import org.jspecify.nullness.*; + +public class CKN extends C<@Nullable CK> {} + +// FILE: main.kt +fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit { + ak.foo(ak) + ak.foo(null) + + akn.foo(null) // the corresponding warning/error is present on the Java side + + bk.foo(bk) + bk.foo(null) + + ck.foo(ck) + ck.foo(null) + + ckn.foo(null) // the corresponding warning/error is present on the Java side +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.fir.kt new file mode 100644 index 00000000000..5890b68f3c4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/Simple.fir.kt @@ -0,0 +1,36 @@ +// JSPECIFY_STATE: warn + +// FILE: Simple.java +import org.jspecify.nullness.*; + +@NullMarked +public class Simple { + @Nullable public Derived field = null; + + @Nullable + public Derived foo(Derived x, @NullnessUnspecified Base y) { + return null; + } + + public Derived bar() { + return null; + } +} + +// FILE: Base.java +public class Base {} + +// FILE: Derived.java +public class Derived extends Base { + void foo() {} +} + +// FILE: main.kt +fun main(a: Simple, x: Derived): Unit { + a.foo(x, null).foo() + a.foo(null, x).foo() + + a.bar().foo() + + a.field.foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.fir.kt new file mode 100644 index 00000000000..0bebf2da605 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeArgumentsFromParameterBounds.fir.kt @@ -0,0 +1,45 @@ +// JSPECIFY_STATE: warn +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: TypeArgumentsFromParameterBounds.java +import org.jspecify.nullness.*; + +@NullMarked +public class TypeArgumentsFromParameterBounds {} + +// FILE: A.java +import org.jspecify.nullness.*; + +@NullMarked +public class A { + public void bar(TypeArgumentsFromParameterBounds a) {} +} + +// FILE: B.java +import org.jspecify.nullness.*; + +public class B { + public void bar(TypeArgumentsFromParameterBounds a) {} +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main( + aNotNullNotNullNotNull: TypeArgumentsFromParameterBounds, + aNotNullNotNullNull: TypeArgumentsFromParameterBounds, + aNotNullNullNotNull: TypeArgumentsFromParameterBounds, + aNotNullNullNull: TypeArgumentsFromParameterBounds, + a: A, b: B +): Unit { + a.bar(aNotNullNotNullNotNull) + a.bar(aNotNullNotNullNull) + a.bar(aNotNullNullNotNull) + a.bar(aNotNullNullNull) + + b.bar(aNotNullNotNullNotNull) + b.bar(aNotNullNotNullNull) + b.bar(aNotNullNullNotNull) + b.bar(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.fir.kt new file mode 100644 index 00000000000..0ddaee33e76 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/TypeParameterBounds.fir.kt @@ -0,0 +1,39 @@ +// JSPECIFY_STATE: warn +// FILE: A.java +import org.jspecify.nullness.*; + +@NullMarked +public class A { + public void foo(@NullnessUnspecified T t) {} + public void bar(E e) {} +} + +// FILE: B.java +import org.jspecify.nullness.*; +@NullMarked +public class B { + public void foo(T t) {} + public void bar(E e) {} +} + +// FILE: Test.java +public class Test {} + +// FILE: main.kt +fun main(a1: A, a2: A, b1: B, b2: B, x: T): Unit { + a1.foo(null) + a1.bar(null) + a1.bar(x) + + a2.foo(null) + a2.bar(null) + a2.bar(x) + + b1.foo(null) + b1.bar(null) + b1.bar(x) + + b2.foo(null) + b2.bar(null) + b2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.fir.kt new file mode 100644 index 00000000000..0af8c19f3c8 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/WildcardsWithDefault.fir.kt @@ -0,0 +1,35 @@ +// JSPECIFY_STATE: warn +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: WildcardsWithDefault.java +import org.jspecify.nullness.*; + +@NullMarked +public class WildcardsWithDefault { + public void noBoundsNotNull(A a) {} + public void noBoundsNullable(A a) {} +} + +// FILE: A.java +import org.jspecify.nullness.*; + +public class A {} + +// FILE: main.kt +fun main( + aNotNullNotNullNotNull: A, + aNotNullNotNullNull: A, + aNotNullNullNotNull: A, + aNotNullNullNull: A, + b: WildcardsWithDefault +): Unit { + b.noBoundsNotNull(aNotNullNotNullNotNull) + b.noBoundsNotNull(aNotNullNotNullNull) + b.noBoundsNotNull(aNotNullNullNotNull) + b.noBoundsNotNull(aNotNullNullNull) + + b.noBoundsNullable(aNotNullNotNullNotNull) + b.noBoundsNullable(aNotNullNotNullNull) + b.noBoundsNullable(aNotNullNullNotNull) + b.noBoundsNullable(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.fir.kt new file mode 100644 index 00000000000..bb4032ca517 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/kt47899.fir.kt @@ -0,0 +1,15 @@ +// JSPECIFY_STATE: warn + +// FILE: Foo.java +import org.jspecify.nullness.Nullable; + +public class Foo { + public static void gauge(@Nullable T stateObject) {} +} + +// FILE: main.kt +fun test(metric: T) { + if (metric is String) { + Foo.gauge(metric) + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.fir.kt new file mode 100644 index 00000000000..c5437e20aba --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.fir.kt @@ -0,0 +1,77 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// SKIP_JAVAC +// SOURCE_RETENTION_ANNOTATIONS +// JSR305_GLOBAL_REPORT: strict + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target({ElementType.TYPE, ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NonNullApi { +} + +// FILE: spr/NullableApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; +import javax.annotation.meta.When; + +@Target({ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NullableApi { +} + +// FILE: A.java +import spr.*; +import java.util.*; + +@NonNullApi +public class A { + public String foo(String x) { return ""; } + public @NullableApi String bar(@NullableApi String y) { return ""; } + public @NullableApi List baz1() { return null; } + public List<@NullableApi String> baz2() { return null; } + public @NullableApi List<@NonNullApi String> baz3() { return null; } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("").length + a.foo(null)?.length + + a.bar("").length + a.bar(null)?.length + + a.baz1().get(0).length + a.baz1()!!.get(0).length + a.baz1()!!.get(0)?.length + + a.baz2().get(0).length + a.baz2()!!.get(0).length + a.baz2()!!.get(0)?.length + + a.baz3().get(0).length + a.baz3()!!.get(0).length + a.baz3()!!.get(0)?.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.fir.kt new file mode 100644 index 00000000000..19e8cbed09f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.fir.kt @@ -0,0 +1,67 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// SKIP_JAVAC +// SOURCE_RETENTION_ANNOTATIONS +// JSR305_GLOBAL_REPORT: strict + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target({ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NonNullApi { +} + +// FILE: spr/NullableApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; +import javax.annotation.meta.When; + +@Target({ElementType.TYPE, ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NullableApi { +} + +// FILE: A.java +import spr.*; +import java.util.*; + +@NonNullApi +public class A { + public String foo(String x) { return ""; } + public @NullableApi String bar(@NullableApi String y) { return ""; } + public @NullableApi List baz1() { return null; } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("").length + a.foo(null)?.length + + a.bar("").length + a.bar(null)?.length + + a.baz1().get(0).length + a.baz1()!!.get(0).length + a.baz1()!!.get(0)?.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.fir.kt new file mode 100644 index 00000000000..c71a03bfae0 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.fir.kt @@ -0,0 +1,79 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict + +// FILE: spr/Nullable.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Target({ElementType.METHOD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierNickname +public @interface Nullable { +} + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NonNullApi { +} + +// FILE: A.java +import spr.*; + +@NonNullApi +public class A { + public String field = null; + + public String foo(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz().get(0) + a.baz()!!.get(0).get(0) + a.baz()!!.get(0)?.get(0) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt new file mode 100644 index 00000000000..f62756e4074 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt @@ -0,0 +1,107 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// RENDER_PACKAGE: test +// SOURCE_RETENTION_ANNOTATIONS +// WITH_RUNTIME +// JSR305_GLOBAL_REPORT: strict + +// FILE: spr/Nullable.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Target({ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierNickname +public @interface Nullable { +} + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.PACKAGE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NonNullApi { +} + +// FILE: test/package-info.java +@spr.NonNullApi() +package test; + +// FILE: test/L.java +package test; + +public class L, S> { + public T t() { return null; } + public S s() { return null; } + + public void setT(@spr.Nullable T t) {} + public void setS(S s) {} +} + +// FILE: test/A.java +package test; + +import spr.*; +import java.util.*; + +public class A { + public void foo(L, @Nullable Integer> l) {} + public void bar(L l) {} + public L, @Nullable Integer> baz1() { return null; } + public L baz2() { return null; } + public L, Integer> baz3() { return null; } +} + +// FILE: main.kt +import test.L + +fun main(a: test.A, l: L, Int?>, l1: L, Int>) { + a.foo(l) + a.foo(l as L, Int>) + a.foo(l as L, Int?>) + + a.bar(l1) + a.bar(l1 as L, Int?>) + + a.baz1().t().containsKey("") + a.baz1().t().containsKey(null) + a.baz1().t().containsValue(1) + a.baz1().t().containsValue(null) + a.baz1().s().hashCode() + + a.baz1().setT(l.t()) + a.baz1().setT(l.t() as L, Int>) + a.baz1().setT(null) + + a.baz2().t().containsKey("") + a.baz2().t().containsKey(null) + a.baz2().t().containsValue(1) + a.baz2().t().containsValue(null) + a.baz2().s().hashCode() + + a.baz3().t().containsKey("") + a.baz3().t().containsKey(null) + a.baz3().t().containsValue(1) + a.baz3().t().containsValue(null) + a.baz3().s().hashCode() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt new file mode 100644 index 00000000000..c1f2bfbd0d2 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt @@ -0,0 +1,77 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// SKIP_JAVAC +// SOURCE_RETENTION_ANNOTATIONS +// JSR305_GLOBAL_REPORT: strict + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target({ElementType.TYPE, ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.TYPE_USE, ElementType.METHOD}) +public @interface NonNullApi { +} + +// FILE: spr/NullableApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; +import javax.annotation.meta.When; + +@Target({ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierDefault({ElementType.TYPE_USE}) +public @interface NullableApi { +} + +// FILE: A.java +import spr.*; +import java.util.*; + +@NonNullApi +public class A { + public String foo(String x) { return ""; } + public @NullableApi String bar(@NullableApi String y) { return ""; } + public @NullableApi List baz1() { return null; } + public List<@NullableApi String> baz2() { return null; } + public @NullableApi List<@NonNullApi String> baz3() { return null; } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("").length + a.foo(null)?.length + + a.bar("").length + a.bar(null)?.length + + a.baz1().get(0).length + a.baz1()!!.get(0).length + a.baz1()!!.get(0)?.length + + a.baz2().get(0).length + a.baz2()!!.get(0).length + a.baz2()!!.get(0)?.length + + a.baz3().get(0).length + a.baz3()!!.get(0).length + a.baz3()!!.get(0)?.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt index 25d923df9ca..1758aeb8f69 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: AnnotatedTypeArguments.java import org.checkerframework.checker.nullness.qual.*; diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt new file mode 100644 index 00000000000..a0cf8342d86 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: ClassTypeParameterBound.java + +import org.jetbrains.annotations.NotNull; + +public class ClassTypeParameterBound { + ClassTypeParameterBound(T x) { } + ClassTypeParameterBound() { } +} + +// FILE: main.kt +fun main(x: ClassTypeParameterBound, y: ClassTypeParameterBound, a: String?, b: String) { + val x2 = ClassTypeParameterBound() + val y2 = ClassTypeParameterBound() + + val x3 = ClassTypeParameterBound(a) + val y3 = ClassTypeParameterBound(b) + + val x4: ClassTypeParameterBound = ClassTypeParameterBound() + val y4: ClassTypeParameterBound = ClassTypeParameterBound() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.fir.kt new file mode 100644 index 00000000000..b869447f4a9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBoundWithWarnings.fir.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated, -TypeEnhancementImprovementsInStrictMode +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: ClassTypeParameterBoundWithWarnings.java + +import org.jetbrains.annotations.NotNull; + +public class ClassTypeParameterBoundWithWarnings { + ClassTypeParameterBoundWithWarnings() { } + ClassTypeParameterBoundWithWarnings(T x) { } +} + +// FILE: main.kt +fun main(x: ClassTypeParameterBoundWithWarnings, y: ClassTypeParameterBoundWithWarnings, a: String?, b: String) { + val x2 = ClassTypeParameterBoundWithWarnings() + val y2 = ClassTypeParameterBoundWithWarnings() + + val x3 = ClassTypeParameterBoundWithWarnings(a) + val y3 = ClassTypeParameterBoundWithWarnings(b) + + val x4: ClassTypeParameterBoundWithWarnings = ClassTypeParameterBoundWithWarnings() + val y4: ClassTypeParameterBoundWithWarnings = ClassTypeParameterBoundWithWarnings() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt index ebf931dbd5d..c25fb5d2fa4 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT // FILE: I1.java import org.checkerframework.checker.nullness.qual.NonNull; diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt index 612eae0693d..50195ff4b7d 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: Outer.java import org.checkerframework.checker.nullness.qual.*; diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.fir.kt new file mode 100644 index 00000000000..00a1fe08270 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/notNullVarargsOverrides.fir.kt @@ -0,0 +1,21 @@ +// SOURCE_RETENTION_ANNOTATIONS +// FILE: BaseClass.java +import org.checkerframework.checker.nullness.qual.*; + +public class BaseClass { + public void loadCache(@NonNull Object... args) {} +} + +// FILE: main.kt +class A : BaseClass() { + // org.checkerframework.checker.nullness.qual.NonNull has @Target TYPE_USE, so it affects only elements type + override fun loadCache(vararg args: Any?) { + super.loadCache(*args) + } +} + +class B : BaseClass() { + override fun loadCache(vararg args: Any) { + super.loadCache(*args) + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.fir.kt new file mode 100644 index 00000000000..9c610957203 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/nullableVarargsOverrides.fir.kt @@ -0,0 +1,21 @@ +// SOURCE_RETENTION_ANNOTATIONS +// FILE: BaseClass.java +import org.checkerframework.checker.nullness.qual.*; + +public class BaseClass { + public void loadCache(@Nullable Object... args) {} +} + +// FILE: main.kt +class A : BaseClass() { + override fun loadCache(vararg args: Any?) { + super.loadCache(*args) + } +} + +class B : BaseClass() { + // org.checkerframework.checker.nullness.qual.Nullable has @Target TYPE_USE, so it affects only elements type + override fun loadCache(vararg args: Any) { + super.loadCache(*args) + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt new file mode 100644 index 00000000000..b5309bc9765 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt @@ -0,0 +1,65 @@ +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// !DIAGNOSTICS: -UNUSED_PARAMETER +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: ReturnType.java + +import org.jetbrains.annotations.*; + +public class ReturnType { + public interface A {} + + public A<@Nullable String, @Nullable T> foo1() { return null; } + public A<@Nullable String, @NotNull T> foo2() { return null; } + public A<@NotNull String, @NotNull T> foo3 = null; + public @NotNull T [] foo4 = null; + public ReturnType<@Nullable String> foo41 = null; + public T foo411 = null; + public @Nullable String [] foo5() { return null; } +} + +// FILE: main.kt +fun takeNotNullStringAndKNullable(x: ReturnType.A) {} +fun takeNullableStringAndKNullable(x: ReturnType.A) {} +fun takeNotNullStringAndNotNullK(x: ReturnType.A) {} +fun takeNullableStringAndNotNullK(x: ReturnType.A) {} +fun takeNotNullString(x: String) {} + +fun takeArrayOfNotNullString(x: Array) {} +fun takeArrayOfNullableString(x: Array) {} +fun takeArrayOfNotNullK(x: Array) {} +fun takeArrayOfNullableK(x: Array) {} + +fun main(a: ReturnType) { + val x1 = ..ReturnType.A?!")!>a.foo1() + takeNotNullStringAndKNullable(x1) + takeNullableStringAndKNullable(x1) + takeNotNullStringAndNotNullK(x1) + takeNullableStringAndNotNullK(x1) + takeNotNullString(a.foo41.foo411) + + val x2 = ..ReturnType.A?!")!>a.foo2() + takeNotNullStringAndKNullable(x2) + takeNullableStringAndKNullable(x2) + takeNotNullStringAndNotNullK(x2) + takeNullableStringAndNotNullK(x2) + + val x3 = ..ReturnType.A?!")!>a.foo3 + takeNotNullStringAndKNullable(x3) + takeNullableStringAndKNullable(x3) + takeNotNullStringAndNotNullK(x3) + takeNullableStringAndNotNullK(x3) + + val x4 = ..kotlin.Array")!>a.foo4 + takeArrayOfNotNullString(x4) + takeArrayOfNullableString(x4) + takeArrayOfNotNullK(x4) + takeArrayOfNullableK(x4) + + val x5 = ?..kotlin.Array??")!>a.foo5() + takeArrayOfNotNullString(x5) + takeArrayOfNullableString(x5) + takeArrayOfNotNullK(x5) + takeArrayOfNullableK(x5) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt index cba2ba66427..4a844177851 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: Outer.java import org.checkerframework.checker.nullness.qual.*; diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.fir.kt new file mode 100644 index 00000000000..ce1c708d98f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeOverrideInKotlin.fir.kt @@ -0,0 +1,31 @@ +// SOURCE_RETENTION_ANNOTATIONS +// FILE: Base.java +public interface Base {} +// FILE: A.java +import org.checkerframework.checker.nullness.qual.*; + +public class A { + @Nullable Base<@NonNull String> foo() { return null; } +} + +// FILE: a.kt +interface Derived : Base {} + +fun bar1(): Derived = null!! +fun bar2(): Derived = null!! + +class B : A() { + override fun foo(): Base { return bar1(); } +} + +class C1 : A() { + override fun foo(): Derived { return bar1(); } +} + +class C2 : A() { + override fun foo(): Derived? { return bar1(); } +} + +class C3 : A() { + override fun foo(): Derived { return bar2(); } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt new file mode 100644 index 00000000000..30beebed8b7 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt @@ -0,0 +1,67 @@ +// !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated, -TypeEnhancementImprovementsInStrictMode +// !DIAGNOSTICS: -UNUSED_PARAMETER +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: ReturnTypeWithWarnings.java +// We've already had errors in source mode, so it's relevant only for binaries for now +// INCLUDE_JAVA_AS_BINARY + +import org.jetbrains.annotations.*; + +public class ReturnTypeWithWarnings { + public interface A {} + + public A<@Nullable String, @Nullable T> foo1() { return null; } + public A<@Nullable String, @NotNull T> foo2() { return null; } + public A<@NotNull String, @NotNull T> foo3 = null; + public @NotNull T [] foo4 = null; + public ReturnTypeWithWarnings<@Nullable String> foo41 = null; + public T foo411 = null; + public @Nullable String [] foo5() { return null; } +} + +// FILE: main.kt +fun takeNotNullStringAndKNullable(x: ReturnTypeWithWarnings.A) {} +fun takeNullableStringAndKNullable(x: ReturnTypeWithWarnings.A) {} +fun takeNotNullStringAndNotNullK(x: ReturnTypeWithWarnings.A) {} +fun takeNullableStringAndNotNullK(x: ReturnTypeWithWarnings.A) {} +fun takeNotNullString(x: String) {} + +fun takeArrayOfNotNullString(x: Array) {} +fun takeArrayOfNullableString(x: Array) {} +fun takeArrayOfNotNullK(x: Array) {} +fun takeArrayOfNullableK(x: Array) {} + +fun main(a: ReturnTypeWithWarnings) { + val x1 = ..ReturnTypeWithWarnings.A?!")!>a.foo1() + takeNotNullStringAndKNullable(x1) + takeNullableStringAndKNullable(x1) + takeNotNullStringAndNotNullK(x1) + takeNullableStringAndNotNullK(x1) + takeNotNullString(a.foo41.foo411) + + val x2 = ..ReturnTypeWithWarnings.A?!")!>a.foo2() + takeNotNullStringAndKNullable(x2) + takeNullableStringAndKNullable(x2) + takeNotNullStringAndNotNullK(x2) + takeNullableStringAndNotNullK(x2) + + val x3 = ..ReturnTypeWithWarnings.A?!")!>a.foo3 + takeNotNullStringAndKNullable(x3) + takeNullableStringAndKNullable(x3) + takeNotNullStringAndNotNullK(x3) + takeNullableStringAndNotNullK(x3) + + val x4 = ..kotlin.Array")!>a.foo4 + takeArrayOfNotNullString(x4) + takeArrayOfNullableString(x4) + takeArrayOfNotNullK(x4) + takeArrayOfNullableK(x4) + + val x5 = ?..kotlin.Array??")!>a.foo5() + takeArrayOfNotNullString(x5) + takeArrayOfNullableString(x5) + takeArrayOfNotNullK(x5) + takeArrayOfNullableK(x5) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt index 31002a7bded..ba30ed9ed2f 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/simple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java import org.checkerframework.checker.nullness.qual.*; import java.util.*; diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.fir.kt new file mode 100644 index 00000000000..e9c7c5350c4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/useTypeParameterAnnotationToEnhanceItsUsages.fir.kt @@ -0,0 +1,14 @@ +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +import org.jetbrains.annotations.*; + +// FILE: MapLike.java +public interface MapLike<@org.jetbrains.annotations.NotNull K> { + void put(K x); +} + +// FILE: main.kt +fun test2(map : MapLike, x2: Int?) { + map.put(x2) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.fir.kt new file mode 100644 index 00000000000..9f053cefa67 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameter.fir.kt @@ -0,0 +1,62 @@ +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: ValueParameter.java + +import org.jetbrains.annotations.*; + +public class ValueParameter { + public interface A {} + + public void foo1(A<@Nullable String, @Nullable T> x) { } + public void foo2(A<@Nullable String, @NotNull T> x) { } + public void foo3(A<@NotNull String, @NotNull T> x) { } + public void foo4(@NotNull T [] x) { } + public void foo41(@Nullable String x) { } + public void foo411(T x) { } + public void foo5(@Nullable String [] x) { } +} + +// FILE: main.kt +fun getNotNullStringAndKNullable() = null as ValueParameter.A +fun getNullableStringAndKNullable() = null as ValueParameter.A +fun getNotNullStringAndNotNullK() = null as ValueParameter.A +fun getNullableStringAndNotNullK() = null as ValueParameter.A +fun getNotNullString() = null as String + +fun getArrayOfNotNullString() = null as Array +fun getArrayOfNullableString() = null as Array +fun getArrayOfNotNullK() = null as Array +fun getArrayOfNullableK() = null as Array + +fun main(a: ValueParameter) { + a.foo1(getNotNullStringAndKNullable()) + a.foo1(getNullableStringAndKNullable()) + a.foo1(getNotNullStringAndNotNullK()) + a.foo1(getNullableStringAndNotNullK()) + + a.foo2(getNotNullStringAndKNullable()) + a.foo2(getNullableStringAndKNullable()) + a.foo2(getNotNullStringAndNotNullK()) + a.foo2(getNullableStringAndNotNullK()) + + a.foo3(getNotNullStringAndKNullable()) + a.foo3(getNullableStringAndKNullable()) + a.foo3(getNotNullStringAndNotNullK()) + a.foo3(getNullableStringAndNotNullK()) + + a.foo4(getArrayOfNotNullString()) + a.foo4(getArrayOfNullableString()) + a.foo4(getArrayOfNotNullK()) + a.foo4(getArrayOfNullableK()) + + a.foo5(getArrayOfNotNullString()) + a.foo5(getArrayOfNullableString()) + a.foo5(getArrayOfNotNullK()) + a.foo5(getArrayOfNullableK()) + + a.foo41(getNotNullString()) + a.foo411(getNotNullString()) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.fir.kt new file mode 100644 index 00000000000..3f1d54ad521 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/valueParameterWithWarnings.fir.kt @@ -0,0 +1,64 @@ +// !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated, -TypeEnhancementImprovementsInStrictMode +// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: ValueParameterWithWarnings.java +// We've already had errors in source mode, so it's relevant only for binaries for now +// INCLUDE_JAVA_AS_BINARY + +import org.jetbrains.annotations.*; + +public class ValueParameterWithWarnings { + public interface A {} + + public void foo1(A<@Nullable String, @Nullable T> x) { } + public void foo2(A<@Nullable String, @NotNull T> x) { } + public void foo3(A<@NotNull String, @NotNull T> x) { } + public void foo4(@NotNull T [] x) { } + public void foo41(@Nullable String x) { } + public void foo411(T x) { } + public void foo5(@Nullable String [] x) { } +} + +// FILE: main.kt +fun getNotNullStringAndKNullable() = null as ValueParameterWithWarnings.A +fun getNullableStringAndKNullable() = null as ValueParameterWithWarnings.A +fun getNotNullStringAndNotNullK() = null as ValueParameterWithWarnings.A +fun getNullableStringAndNotNullK() = null as ValueParameterWithWarnings.A +fun getNotNullString() = null as String + +fun getArrayOfNotNullString() = null as Array +fun getArrayOfNullableString() = null as Array +fun getArrayOfNotNullK() = null as Array +fun getArrayOfNullableK() = null as Array + +fun main(a: ValueParameterWithWarnings) { + a.foo1(getNotNullStringAndKNullable()) + a.foo1(getNullableStringAndKNullable()) + a.foo1(getNotNullStringAndNotNullK()) + a.foo1(getNullableStringAndNotNullK()) + + a.foo2(getNotNullStringAndKNullable()) + a.foo2(getNullableStringAndKNullable()) + a.foo2(getNotNullStringAndNotNullK()) + a.foo2(getNullableStringAndNotNullK()) + + a.foo3(getNotNullStringAndKNullable()) + a.foo3(getNullableStringAndKNullable()) + a.foo3(getNotNullStringAndNotNullK()) + a.foo3(getNullableStringAndNotNullK()) + + a.foo4(getArrayOfNotNullString()) + a.foo4(getArrayOfNullableString()) + a.foo4(getArrayOfNotNullK()) + a.foo4(getArrayOfNullableK()) + + a.foo5(getArrayOfNotNullString()) + a.foo5(getArrayOfNullableString()) + a.foo5(getArrayOfNotNullK()) + a.foo5(getArrayOfNullableK()) + + a.foo41(getNotNullString()) + a.foo411(getNotNullString()) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.fir.kt new file mode 100644 index 00000000000..687cca1fcb2 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/warningsBasedOnEnhancedBasedType.fir.kt @@ -0,0 +1,23 @@ +// !LANGUAGE: -TypeEnhancementImprovementsInStrictMode +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// SKIP_TXT +// MUTE_FOR_PSI_CLASS_FILES_READING + +// We've already had errors in source mode, so it's relevant only for binaries for now + +// FILE: Base.java +// INCLUDE_JAVA_AS_BINARY +public class Base {} + +// FILE: Test.java +// INCLUDE_JAVA_AS_BINARY +import org.jetbrains.annotations.Nullable; + +class Test extends Base<@Nullable String> {} + +// FILE: main.kt +fun takeBaseOfNotNullStrings(x: Base) {} + +fun main() { + val x = takeBaseOfNotNullStrings(Test()) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt index 4f28e4b9751..2ab24dfb902 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeUseOnObject.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java import org.checkerframework.checker.nullness.qual.*; public class A { diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.fir.kt new file mode 100644 index 00000000000..460c9e5d66d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.fir.kt @@ -0,0 +1,25 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/Test.java +package test; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt index 2047f22629a..8fe4f23b447 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ALLOW_KOTLIN_PACKAGE // JSPECIFY_STATE: strict @@ -25,4 +26,4 @@ import test.Test fun main(x: Test) { x.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.fir.kt new file mode 100644 index 00000000000..83606133e3c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.fir.kt @@ -0,0 +1,31 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/package-info.java +@NullMarked +package test; + +import org.jspecify.nullness.NullMarked; + +// FILE: sandbox/test/Test.java +package test; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt index 5dbdcd1cdc3..400a55791e4 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ALLOW_KOTLIN_PACKAGE // JSPECIFY_STATE: strict @@ -27,4 +28,4 @@ public class Test { // FILE: main.kt fun main(y: test2.Test) { y.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.fir.kt new file mode 100644 index 00000000000..5036b778052 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.fir.kt @@ -0,0 +1,30 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// MODULE: module1 +// FILE: module1/module-info.java +module module1 { +} + +// MODULE: module2(module1) +// FILE: module2/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module2 { + requires java9_annotations; + requires module1; + exports test2; +} + +// FILE: module2/test2/Test.java +package test2; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +fun main(y: test2.Test) { + y.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt index be462fa9280..394b4edbe35 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ALLOW_KOTLIN_PACKAGE // JSPECIFY_STATE: strict @@ -41,4 +42,4 @@ import test.Test fun main(x: Test) { x.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.fir.kt new file mode 100644 index 00000000000..259073d4fed --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.fir.kt @@ -0,0 +1,25 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// FILE: my.sand.box/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +open module my.sand.box { + requires java9_annotations; + exports my.test; +} + +// FILE: my.sand.box/my/test/Test.java +package my.test; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import my.test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.fir.kt new file mode 100644 index 00000000000..e309e391e78 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.fir.kt @@ -0,0 +1,45 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// MODULE: module1 +// FILE: module1/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module1 { + requires java9_annotations; + exports test1; +} + +// FILE: module1/test1/Test1.java +package test1; + +public class Test1 { + public void foo(Integer x) {} +} + +// MODULE: module2(module1) +// FILE: module2/module-info.java +module module2 { + requires module1; + exports test2; +} + +// FILE: module2/test2/Test2.java +package test2; + +import test1.Test1; + +public class Test2 extends Test1 { + public void foo2(Integer x) {} +} + +// FILE: main.kt +import test1.Test1 +import test2.Test2 + +fun main(x: Test1, y: Test2) { + x.foo(null) + y.foo(null) + y.foo2(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.fir.kt new file mode 100644 index 00000000000..c78c06369d3 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.fir.kt @@ -0,0 +1,43 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/Test.java +package test; + +public class Test { + public static class Test2 { + public Integer foo(Integer x) { return 1; } + public static class Test4 { + public Integer foo(Integer x) { return 1; } + } + public class Test5 { + public Integer foo(Integer x) { return 1; } + } + } + public class Test3 { + public Integer foo(Integer x) { return 1; } + public class Test5 { + public Integer foo(Integer x) { return 1; } + } + } +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.Test3().foo(null) + x.Test3().Test5().foo(null) + + Test.Test2().foo(null) + Test.Test2().Test5().foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt index 1903f33212c..fbf83768f19 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ALLOW_KOTLIN_PACKAGE // JSPECIFY_STATE: strict @@ -24,4 +25,4 @@ import test.Test fun main(x: Test) { x.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.fir.kt new file mode 100644 index 00000000000..9c082d07423 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.fir.kt @@ -0,0 +1,39 @@ +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// MODULE: module1 +// FILE: module1/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module1 { + requires java9_annotations; + exports test1; +} + +// FILE: module1/test1/Test.java +package test1; + +public class Test { + public void foo(Integer x) {} +} + +// MODULE: module2(module1) +// FILE: module2/module-info.java +module module2 { + requires module1; + exports test2; +} + +// FILE: module2/test2/Test.java +package test2; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +fun main(x: test1.Test, y: test2.Test) { + x.foo(null) + y.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.fir.kt new file mode 100644 index 00000000000..140f5cd7446 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.fir.kt @@ -0,0 +1,25 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/Test.java +package test; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt new file mode 100644 index 00000000000..0225adb71b7 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt @@ -0,0 +1,28 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// FILE: sandbox/test/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/Test.java +package test; + +import org.jspecify.nullness.NullMarked; + +@NullMarked +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt new file mode 100644 index 00000000000..a8c6dea1146 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt @@ -0,0 +1,31 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/package-info.java +@NullMarked +package test; + +import org.jspecify.nullness.NullMarked; + +// FILE: sandbox/test/Test.java +package test; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt index cb5e10638de..6bb0013d7e1 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: warn // ALLOW_KOTLIN_PACKAGE @@ -27,4 +28,4 @@ public class Test { // FILE: main.kt fun main(y: test2.Test) { y.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt new file mode 100644 index 00000000000..5a18583c504 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt @@ -0,0 +1,30 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// MODULE: module1 +// FILE: module1/module-info.java +module module1 { +} + +// MODULE: module2(module1) +// FILE: module2/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module2 { + requires java9_annotations; + requires module1; + exports test2; +} + +// FILE: module2/test2/Test.java +package test2; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +fun main(y: test2.Test) { + y.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt index fdfabd2f45e..e7726d31e69 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: warn // ALLOW_KOTLIN_PACKAGE @@ -41,4 +42,4 @@ import test.Test fun main(x: Test) { x.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.fir.kt new file mode 100644 index 00000000000..a6833e397c4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.fir.kt @@ -0,0 +1,25 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// FILE: my.sand.box/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +open module my.sand.box { + requires java9_annotations; + exports my.test; +} + +// FILE: my.sand.box/my/test/Test.java +package my.test; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +import my.test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt new file mode 100644 index 00000000000..b3a6eb69c54 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt @@ -0,0 +1,45 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// MODULE: module1 +// FILE: module1/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module1 { + requires java9_annotations; + exports test1; +} + +// FILE: module1/test1/Test1.java +package test1; + +public class Test1 { + public void foo(Integer x) {} +} + +// MODULE: module2(module1) +// FILE: module2/module-info.java +module module2 { + requires module1; + exports test2; +} + +// FILE: module2/test2/Test2.java +package test2; + +import test1.Test1; + +public class Test2 extends Test1 { + public void foo2(Integer x) {} +} + +// FILE: main.kt +import test1.Test1 +import test2.Test2 + +fun main(x: Test1, y: Test2) { + x.foo(null) + y.foo(null) + y.foo2(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.fir.kt new file mode 100644 index 00000000000..1e674e3e15a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.fir.kt @@ -0,0 +1,43 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/Test.java +package test; + +public class Test { + public static class Test2 { + public Integer foo(Integer x) { return 1; } + public static class Test4 { + public Integer foo(Integer x) { return 1; } + } + public class Test5 { + public Integer foo(Integer x) { return 1; } + } + } + public class Test3 { + public Integer foo(Integer x) { return 1; } + public class Test5 { + public Integer foo(Integer x) { return 1; } + } + } +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.Test3().foo(null) + x.Test3().Test5().foo(null) + + Test.Test2().foo(null) + Test.Test2().Test5().foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt index 4f221b386c8..1f42a680414 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt @@ -1,3 +1,5 @@ +// FIR_IDENTICAL +// FIR_IDENTICAL // JSPECIFY_STATE: warn // ALLOW_KOTLIN_PACKAGE @@ -24,4 +26,4 @@ import test.Test fun main(x: Test) { x.foo(null) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt new file mode 100644 index 00000000000..5e99d57f9fe --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt @@ -0,0 +1,39 @@ +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// MODULE: module1 +// FILE: module1/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module1 { + requires java9_annotations; + exports test1; +} + +// FILE: module1/test1/Test.java +package test1; + +public class Test { + public void foo(Integer x) {} +} + +// MODULE: module2(module1) +// FILE: module2/module-info.java +module module2 { + requires module1; + exports test2; +} + +// FILE: module2/test2/Test.java +package test2; + +public class Test { + public void foo(Integer x) {} +} + +// FILE: main.kt +fun main(x: test1.Test, y: test2.Test) { + x.foo(null) + y.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.fir.kt new file mode 100644 index 00000000000..c447a1497c2 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidRecently.fir.kt @@ -0,0 +1,52 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER + +// FILE: A.java +import androidx.annotation.*; + +public class A { + @RecentlyNullable public String field = null; + + @RecentlyNullable + public String foo(@RecentlyNonNull String x, @RecentlyNullable CharSequence y) { + return ""; + } + + @RecentlyNonNull + public String bar() { + return ""; + } + + @RecentlyNullable + public T baz(@RecentlyNonNull T x) { return x; } + + @RecentlyNonNull + public T baz2(@RecentlyNullable T x) { return x; } +} + +// FILE: main.kt +fun main(a: A, a1: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length + + a.baz2("").length + a.baz2("")?.length + a.baz2("")!!.length + + a.baz2(null).length + a.baz2(null)?.length + a.baz2(null)!!.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt index 8189d2a84fe..63fee8bd539 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidSdk.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt index dd861ee242a..35993d37b91 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/android_support.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt index 5d41f35846e..c90835ba2c5 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/androidx.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt index 2d91a7b10e5..717588fe451 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/aosp.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // SOURCE_RETENTION_ANNOTATIONS diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt index 2b70cb1710e..8ff63ac166e 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/checkerFramework.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt index 2a6541730d6..bd8c96e1f76 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/eclipse.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt index b3a90e96cd9..4e0e672a1fb 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/findBugsSimple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt index 0279fb66222..90ff3065f58 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/irrelevantQualifierNicknames.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: UnknownQualifier.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt index 068b85ca222..6dec2d3a315 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/dontIgnoreAnnotationsWithoutTarget.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode // !DIAGNOSTICS: -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.fir.kt new file mode 100644 index 00000000000..480894574f1 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/ignore/parametersAreNonnullByDefault.fir.kt @@ -0,0 +1,33 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: ignore + +// FILE: A.java +import javax.annotation.*; + +@ParametersAreNonnullByDefault +public class A { + @Nullable public String field = null; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + // foo is platform + a.foo("", "", null)?.length + a.foo("", "", null).length + a.foo(null, null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt index 845f4ff5300..f1e6a2ad89f 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nonNullNever.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt index 03750f1ebc3..780965f5da9 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityNicknames.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.fir.kt new file mode 100644 index 00000000000..0bbc430309f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/elvis.fir.kt @@ -0,0 +1,85 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// JSR305_GLOBAL_REPORT: warn + +// FILE: MyNotNull.java +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.PARAMETER}) +@Nonnull +@TypeQualifierNickname +@Retention(RetentionPolicy.RUNTIME) +public @interface MyNotNull {} + + +// FILE: AnnotatedWithJsr.java +public class AnnotatedWithJsr { + @MyNotNull + public String getString() { + return null; + } + + public void consumeString(@MyNotNull String s) { } +} + + + +// FILE: AnnotatedWithJB.java +import org.jetbrains.annotations.NotNull; + +public class AnnotatedWithJB { + public @NotNull String getString() { + return "hello"; + } + + public void consumeString(@NotNull String s) { } +} + + +// FILE: PlainJava.java +public class PlainJava { + public String getString() { + return null; + } + + public void consumeString(String s) { } +} + + +// FILE: main.kt +val jsr: AnnotatedWithJsr = AnnotatedWithJsr() +val jsrNullable: AnnotatedWithJsr? = null + +val jb: AnnotatedWithJB = AnnotatedWithJB() +val jbNullable: AnnotatedWithJB? = null + +val platform: PlainJava = PlainJava() +val platformNullable: PlainJava? = null + +object Elvis { + fun fromJava() { + val a = jsr.string ?: "" + val b = jsrNullable?.string ?: "" + + val c = jb.string ?: "" + val d = jbNullable?.string ?: "" + + val e = platform.string ?: "" + val f = platformNullable?.string ?: "" + } + + fun toJava(nullableString: String?) { + val b = jsr.consumeString(nullableString ?: "") + val d = jsrNullable?.consumeString(nullableString ?: "") + + val f = jb.consumeString(nullableString ?: "") + val h = jbNullable?.consumeString(nullableString ?: "") + + val j = platform.consumeString(nullableString ?: "") + val l = platformNullable?.consumeString(nullableString ?: "") + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.fir.kt new file mode 100644 index 00000000000..e58a324fba4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/arithmetic.fir.kt @@ -0,0 +1,49 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static Integer staticNN; + @MyNullable + public static Integer staticN; + public static Integer staticJ; +} + +// FILE: k.kt +fun test() { + var platformNN = J.staticNN + var platformN = J.staticN + var platformJ = J.staticJ + + +platformNN + +platformN + +platformJ + + ++platformNN + ++platformN + ++platformJ + + platformNN++ + platformN++ + platformJ++ + + 1 + platformNN + 1 + platformN + 1 + platformJ + + platformNN + 1 + platformN + 1 + platformJ + 1 + + 1 plus platformNN + 1 plus platformN + 1 plus platformJ + + platformNN plus 1 + platformN plus 1 + platformJ plus 1 + + platformNN += 1 + platformN += 1 + platformJ += 1 +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.fir.kt new file mode 100644 index 00000000000..3e9b0e3b1aa --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/array.fir.kt @@ -0,0 +1,25 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static Integer[] staticNN; + @MyNullable + public static Integer[] staticN; + public static Integer[] staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + platformNN[0] + platformN[0] + platformJ[0] + + platformNN[0] = 1 + platformN[0] = 1 + platformJ[0] = 1 +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.fir.kt new file mode 100644 index 00000000000..bd8a5630257 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/assignToVar.fir.kt @@ -0,0 +1,24 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; +} + +// FILE: k.kt +var v: J = J() +var n: J? = J() + +fun test() { + v = J.staticNN + v = J.staticN + v = J.staticJ + + n = J.staticNN + n = J.staticN + n = J.staticJ +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.fir.kt new file mode 100644 index 00000000000..b78da5dc423 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/conditions.fir.kt @@ -0,0 +1,42 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static Boolean staticNN; + @MyNullable + public static Boolean staticN; + public static Boolean staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + if (platformNN) {} + if (platformN) {} + if (platformJ) {} + + while (platformNN) {} + while (platformN) {} + while (platformJ) {} + + do {} while (platformNN) + do {} while (platformN) + do {} while (platformJ) + + platformNN && false + platformN && false + platformJ && false + + platformNN || false + platformN || false + platformJ || false + + !platformNN + !platformN + !platformJ +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.fir.kt new file mode 100644 index 00000000000..61e7a5d9d3f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/dataFlowInfo.fir.kt @@ -0,0 +1,29 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; +} + +// FILE: k.kt +fun test() { + val n = J.staticN + foo(n) + J.staticNN = n + if (n != null) { + foo(n) + J.staticNN = n + } + + val x: J? = null + J.staticNN = x + if (x != null) { + J.staticNN = x + } +} + +fun foo(j: J) {} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.fir.kt new file mode 100644 index 00000000000..7fd62ba0c5a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/defaultParameters.fir.kt @@ -0,0 +1,22 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + fun foo(p: J = platformNN, p1: J = platformN, p2: J = platformJ) {} + + fun foo1(p: J? = platformNN, p1: J? = platformN, p2: J? = platformJ) {} +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.fir.kt new file mode 100644 index 00000000000..25cf058091f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegatedProperties.fir.kt @@ -0,0 +1,21 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + + public interface DP { + String getValue(Object a, Object b); + String setValue(Object a, Object b, Object c); + } + + @MyNonnull + public static DP staticNN; + @MyNullable + public static DP staticN; + public static DP staticJ; +} + +// FILE: k.kt +var A by J.staticNN +var B by J.staticN +var C by J.staticJ diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.fir.kt new file mode 100644 index 00000000000..41341f45d75 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/delegation.fir.kt @@ -0,0 +1,17 @@ +// JSR305_GLOBAL_REPORT: warn +// FULL_JDK +// FILE: J.java +import java.util.*; + +public class J { + @MyNonnull + public static List staticNN; + @MyNullable + public static List staticN; + public static List staticJ; +} + +// FILE: k.kt +class A : List by J.staticNN +class B : List by J.staticN +class C : List by J.staticJ diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.fir.kt new file mode 100644 index 00000000000..e8e2c0065e6 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceExtension.fir.kt @@ -0,0 +1,39 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + platformNN.foo() + platformN.foo() + platformJ.foo() + + with(platformNN) { + foo() + } + with(platformN) { + foo() + } + with(platformJ) { + foo() + } + + platformNN.bar() + platformN.bar() + platformJ.bar() +} + +fun J.foo() {} +fun J?.bar() {} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.fir.kt new file mode 100644 index 00000000000..6ed0aa0199f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/derefenceMember.fir.kt @@ -0,0 +1,37 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; + + public void foo() {} +} + +// FILE: k.kt +fun test() { + // @NotNull platform type + val platformNN = J.staticNN + // @Nullable platform type + val platformN = J.staticN + // platform type with no annotation + val platformJ = J.staticJ + + platformNN.foo() + platformN.foo() + platformJ.foo() + + with(platformNN) { + foo() + } + with(platformN) { + foo() + } + with(platformJ) { + foo() + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.fir.kt new file mode 100644 index 00000000000..8cd2991126b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/expectedType.fir.kt @@ -0,0 +1,26 @@ +// !CHECK_TYPE +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + checkSubtype(platformNN) + checkSubtype(platformN) + checkSubtype(platformJ) + + checkSubtype(platformNN) + checkSubtype(platformN) + checkSubtype(platformJ) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.fir.kt new file mode 100644 index 00000000000..f15e339e213 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/for.fir.kt @@ -0,0 +1,23 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +import java.util.*; + +public class J { + @MyNonnull + public static List staticNN; + @MyNullable + public static List staticN; + public static List staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + for (x in platformNN) {} + for (x in platformN) {} + for (x in platformJ) {} +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.fir.kt new file mode 100644 index 00000000000..3fdffccead5 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/functionArguments.fir.kt @@ -0,0 +1,25 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; +} + +// FILE: k.kt +fun test() { + foo(J.staticNN) + foo(J.staticN) + foo(J.staticJ) + + bar(J.staticNN) + bar(J.staticN) + bar(J.staticJ) +} + +fun foo(j: J) {} +fun bar(j: J?) {} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.fir.kt new file mode 100644 index 00000000000..cf4b3bb3d5c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/invoke.fir.kt @@ -0,0 +1,21 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + public interface Invoke { + void invoke(); + } + + @MyNonnull + public static Invoke staticNN; + @MyNullable + public static Invoke staticN; + public static Invoke staticJ; +} + +// FILE: k.kt +fun test() { + J.staticNN() + J.staticN() + J.staticJ() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.fir.kt new file mode 100644 index 00000000000..bbb62055ab1 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/kt6829.fir.kt @@ -0,0 +1,21 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// KT-6829 False warning on map to @Nullable + +// FILE: J.java +public class J { + + @MyNullable + public String method() { return ""; } +} + +// FILE: k.kt +fun foo(collection: Collection) { + val mapped = collection.map { it.method() } + mapped[0].length +} + +public fun Iterable.map(transform: (T) -> R): List { + null!! +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.fir.kt new file mode 100644 index 00000000000..262d806d390 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/multiDeclaration.fir.kt @@ -0,0 +1,27 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + public interface Multi { + String component1(); + String component2(); + } + + @MyNonnull + public static Multi staticNN; + @MyNullable + public static Multi staticN; + public static Multi staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + val (a1, b1) = platformNN + val (a2, b2) = platformN + val (a3, b3) = platformJ +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.fir.kt new file mode 100644 index 00000000000..c6a46e270e9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/passToJava.fir.kt @@ -0,0 +1,88 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java + +public class J { + @MyNonnull + public static J staticNN; + @MyNullable + public static J staticN; + public static J staticJ; + + public static void staticSet(@MyNonnull J nn, @MyNullable J n, J j) {} + + public J(@MyNonnull J nn, @MyNullable J n, J j) {} + public J() {} + + @MyNonnull + public J nn; + @MyNullable + public J n; + public J j; + + public void set(@MyNonnull J nn, @MyNullable J n, J j) {} +} + +// FILE: k.kt +fun test(n: J?, nn: J) { + // @NotNull platform type + val platformNN = J.staticNN + // @Nullable platform type + val platformN = J.staticN + // platform type with no annotation + val platformJ = J.staticJ + + J.staticNN = n + J.staticNN = platformN + J.staticNN = nn + J.staticNN = platformNN + J.staticNN = platformJ + + J.staticN = n + J.staticN = platformN + J.staticN = nn + J.staticN = platformNN + J.staticN = platformJ + + J.staticJ = n + J.staticJ = platformN + J.staticJ = nn + J.staticJ = platformNN + J.staticJ = platformJ + + J.staticSet(nn, nn, nn) + J.staticSet(platformNN, platformNN, platformNN) + J.staticSet(n, n, n) + J.staticSet(platformN, platformN, platformN) + J.staticSet(platformJ, platformJ, platformJ) + + J().nn = n + J().nn = platformN + J().nn = nn + J().nn = platformNN + J().nn = platformJ + + J().n = n + J().n = platformN + J().n = nn + J().n = platformNN + J().n = platformJ + + J().j = n + J().j = platformN + J().j = nn + J().j = platformNN + J().j = platformJ + + J().set(nn, nn, nn) + J().set(platformNN, platformNN, platformNN) + J().set(n, n, n) + J().set(platformN, platformN, platformN) + J().set(platformJ, platformJ, platformJ) + + J(nn, nn, nn) + J(platformNN, platformNN, platformNN) + J(n, n, n) + J(platformN, platformN, platformN) + J(platformJ, platformJ, platformJ) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.fir.kt new file mode 100644 index 00000000000..3a010fcb7aa --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/primitiveArray.fir.kt @@ -0,0 +1,25 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static int[] staticNN; + @MyNullable + public static int[] staticN; + public static int[] staticJ; +} + +// FILE: k.kt +fun test() { + val platformNN = J.staticNN + val platformN = J.staticN + val platformJ = J.staticJ + + platformNN[0] + platformN[0] + platformJ[0] + + platformNN[0] = 1 + platformN[0] = 1 + platformJ[0] = 1 +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.fir.kt new file mode 100644 index 00000000000..ebdc43874c4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/throw.fir.kt @@ -0,0 +1,23 @@ +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNonnull + public static Exception staticNN; + @MyNullable + public static Exception staticN; + public static Exception staticJ; +} + +// FILE: k.kt +fun test() { + throw J.staticNN +} + +fun test1() { + throw J.staticN +} + +fun test2() { + throw J.staticJ +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.fir.kt new file mode 100644 index 00000000000..d4c31e8530d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/fromPlatformTypes/uselessElvisRightIsNull.fir.kt @@ -0,0 +1,32 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: J.java +public class J { + @MyNullable + public static J staticN; +} + +// FILE: JJ.java +public class JJ { + public static JJ staticNN; +} + +// FILE: JJJ.java +public class JJJ { + @MyNonnull + public static JJJ staticNNN; +} + +// FILE: k.kt +fun test() { + val a = J.staticN ?: null + foo(a) + val b = JJ.staticNN ?: null + foo(b) + val c = JJJ.staticNNN ?: null + foo(c) +} + +fun foo(a: Any?) { +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.fir.kt new file mode 100644 index 00000000000..840dbdf2103 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/localInference.fir.kt @@ -0,0 +1,96 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_EXPRESSION +// JSR305_GLOBAL_REPORT: warn + +// FILE: MyNotNull.java +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.PARAMETER}) +@Nonnull +@TypeQualifierNickname +@Retention(RetentionPolicy.RUNTIME) +public @interface MyNotNull {} + + +// FILE: AnnotatedWithJsr.java +public class AnnotatedWithJsr { + @MyNotNull + public String getString() { + return null; + } + + public void consumeString(@MyNotNull String s) { } +} + + + +// FILE: AnnotatedWithJB.java +import org.jetbrains.annotations.NotNull; + +public class AnnotatedWithJB { + public @NotNull String getString() { + return "hello"; + } + + public void consumeString(@NotNull String s) { } +} + + +// FILE: PlainJava.java +public class PlainJava { + public String getString() { + return null; + } + + public void consumeString(String s) { } +} + + +// FILE: main.kt +val jsr: AnnotatedWithJsr = AnnotatedWithJsr() +val jsrNullable: AnnotatedWithJsr? = null + +val jb: AnnotatedWithJB = AnnotatedWithJB() +val jbNullable: AnnotatedWithJB? = null + +val platform: PlainJava = PlainJava() +val platformNullable: PlainJava? = null + +val a = jsr.string +val b = jsrNullable?.string +val c = jb.string +val d = jbNullable?.string +val e = platform.string +val f = platformNullable?.string + +fun evlis() { + // JSR + val r1 = a ?: "" + val r2 = b ?: "" + + // JB + val r3 = c ?: "" + val r4 = d ?: "" + + // Platform + val r5 = e ?: "" + val r6 = f ?: "" +} + +fun ifChecksAndSmartCasts() { + // JSR + val r1 = if (a == null) 42 else a.length + val r2 = if (b == null) 42 else b.length + + // JB + val r3 = if (c == null) 42 else c.length + val r4 = if (d == null) 42 else d.length + + // Platform + val r5 = if (e == null) 42 else e.length + val r6 = if (f == null) 42 else f.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.fir.kt new file mode 100644 index 00000000000..33c0aac308a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityGenerics.fir.kt @@ -0,0 +1,40 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: A.java +public class A { + public void foo(@MyNonnull T t) { + } + + public @MyNullable String bar() { + return null; + } + + public @MyNullable T bam() { + return null; + } + + @MyNullable + public X baz() { + return null; + } + +} +// FILE: main.kt +class X(t: T?) { + + init { + val a = A() + a.foo(t) + + val x: T = a.bam() + val y: T = a.baz() + } +} + +fun test() { + val a = A() + a.foo(null) + + val b: String = a.bar() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.fir.kt new file mode 100644 index 00000000000..5155b6c05b9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/nullabilityNicknames.fir.kt @@ -0,0 +1,91 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: MyNullable.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.MAYBE) +@Retention(RetentionPolicy.RUNTIME) +public @interface MyNullable { + +} + +// FILE: MyCheckForNull.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Documented +@TypeQualifierNickname +@CheckForNull +@Retention(RetentionPolicy.RUNTIME) +public @interface MyCheckForNull { + +} + +// FILE: MyNonnull.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.ALWAYS) +@Retention(RetentionPolicy.RUNTIME) +public @interface MyNonnull { + +} + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyNullable public String field = null; + + @MyNullable + public String foo(@MyNonnull String x, @MyNullable CharSequence y) { + return ""; + } + + @MyNonnull + public String bar() { + return ""; + } + + @MyCheckForNull + public String baz(@MyNonnull String x, @MyCheckForNull CharSequence y) { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.baz("", null).length + a.baz(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt index 39c0347a208..1c734073b4f 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // JSR305_GLOBAL_REPORT: warn diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt index 14d2cd8a792..3447707d0b1 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/simple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: warn diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt index 43da34d3222..4a445fec1d6 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/strange.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: warn diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.fir.kt new file mode 100644 index 00000000000..0832e8ff6cb --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/equalsOnNonNull.fir.kt @@ -0,0 +1,46 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) +public @interface NonNullApi { +} + +// FILE: A.java +import spr.*; + +@NonNullApi +public class A { + public String getBar() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + if (a.getBar() == "1" && a.hashCode() != 0) return + if (a.getBar() != "2" && a.hashCode() != 0) return + + if (a.getBar() == null && a.hashCode() != 0) return + if (a.getBar() != null && a.hashCode() != 0) return + + if (a.bar == "1" && a.hashCode() != 0) return + if (a.bar != "2" && a.hashCode() != 0) return + + if (a.bar == null && a.hashCode() != 0) return + if (a.bar != null && a.hashCode() != 0) return +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt new file mode 100644 index 00000000000..60e3980449e --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt @@ -0,0 +1,57 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: FieldsAreNullable.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.FIELD}) +public @interface FieldsAreNullable { +} + +// FILE: A.java +import javax.annotation.*; + +@FieldsAreNullable +public class A { + public String field = null; + @Nonnull + public String nonNullField = ""; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + // foo is platform + a.foo("", "", null)?.length + a.foo("", "", null).length + a.foo(null, null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + a.field = null + + a.nonNullField?.length + a.nonNullField.length + a.nonNullField = null +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.fir.kt new file mode 100644 index 00000000000..1ed97838dbf --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/nullabilityFromOverridden.fir.kt @@ -0,0 +1,152 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: NonNullApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NonNullApi { +} + +// FILE: NullableApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NullableApi { +} + +// FILE: A.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public class A { + public String foo1(String x) { return ""; } + public String foo2(String x) { return ""; } + public String foo3(String x) { return ""; } + + + @Nullable + public String bar1(@Nullable String x) { return ""; } + @Nullable + public String bar2(@Nullable String x) { return ""; } + + public String baz(@Nonnull String x) { return ""; } +} + +// FILE: AInt.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public interface AInt { + public CharSequence foo1(String x); + public CharSequence foo2(String x); + public CharSequence foo3(String x); + + + @Nullable + public CharSequence bar1(@Nullable String x); + @Nullable + public CharSequence bar2(@Nullable String x); + + public CharSequence baz(@Nonnull String x); +} + + +// FILE: B.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NullableApi +public class B extends A implements AInt { + // conflicts + public String foo1(String x) { return ""; } + + // no conflicts + @Nonnull + public String foo2(@Nonnull String x) { return ""; } + + // fake override for foo3 shouldn't have any conflicts + + // no conflicts + public String bar1(String x) { return ""; } + + // conflicts + public String baz(String x) { return ""; } +} + +// FILE: C.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public class C extends A implements AInt { + // no conflicts + public String foo1(String x) { return ""; } + + // no conflicts + public String foo2(@Nonnull String x) { return ""; } + + // fake override for foo3 shouldn't have any conflicts + + // no conflicts, covariant override + public String bar1(String x) { return ""; } + // no conflicts + @Nullable + public String bar2(@Nullable String x) { return ""; } + + // no conflicts + public String baz(String x) { return ""; } +} + +// FILE: main.kt +fun main(a: A, b: B, c: C) { + a.foo1(null).length + a.foo2(null).length + a.foo3(null).length + a.bar1(null).length + a.bar2(null).length + a.baz(null).length + + b.foo1(null).length + b.foo1(null)?.length + b.foo2(null).length + b.foo3(null).length + b.bar1(null).length + b.bar2(null).length + b.baz(null).length + b.baz(null)?.length + + c.foo1(null).length + c.foo2(null).length + c.foo3(null).length + c.bar1(null).length + c.bar1(null)?.length + c.bar2(null).length + c.baz(null).length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.fir.kt new file mode 100644 index 00000000000..abb4678b68d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/overridingDefaultQualifier.fir.kt @@ -0,0 +1,181 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: NonNullApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NonNullApi { +} + +// FILE: NullableApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NullableApi { +} + +// FILE: FieldsAreNullable.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.FIELD}) +public @interface FieldsAreNullable { +} + +// FILE: A.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public class A { + public String field = null; + + public String foo(String x, @CheckForNull CharSequence y) { + return ""; + } + + @NullableApi + public String foobar(String x, @Nonnull CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } + + @NullableApi + public class B { + public String field = null; + + public String foo(String x, @Nonnull CharSequence y) { + return ""; + } + + @NonNullApi + public String foobar(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } + } + + @FieldsAreNullable + public class C { + public String field = null; + + public String foo(String x, @Nullable CharSequence y) { + return ""; + } + + @NullableApi + public String foobar(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } + } +} + +// FILE: main.kt +fun main(a: A, b: A.B, c: A.C) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.foobar(null, "").length + a.foobar("", null)?.length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz().get(0) + a.baz()!!.get(0).get(0) + a.baz()!!.get(0)?.get(0) + + // b + b.foo("", null)?.length + b.foo("", null).length + b.foo(null, "").length + + b.foobar(null, "").length + b.foobar("", null)?.length + + b.bar().length + b.bar()!!.length + + b.field?.length + b.field.length + + b.baz().get(0) + b.baz()!!.get(0).get(0) + b.baz()!!.get(0)?.get(0) + + // c + c.foo("", null)?.length + c.foo("", null).length + c.foo(null, "").length + + c.foobar(null, "").length + c.foobar("", null)?.length + + c.bar().length + c.bar()!!.length + + c.field?.length + c.field.length + + c.baz().get(0) + c.baz()!!.get(0).get(0) + c.baz()!!.get(0)?.get(0) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.fir.kt new file mode 100644 index 00000000000..52161145d86 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefault.fir.kt @@ -0,0 +1,33 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: A.java +import javax.annotation.*; + +@ParametersAreNonnullByDefault +public class A { + @Nullable public String field = null; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + // foo is platform + a.foo("", "", null)?.length + a.foo("", "", null).length + a.foo(null, null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt new file mode 100644 index 00000000000..945094b559b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt @@ -0,0 +1,68 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: test/package-info.java +@javax.annotation.ParametersAreNonnullByDefault() +package test; + +// FILE: test/A.java +package test; + +import javax.annotation.*; + +public class A { + @Nullable public String field = null; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: test2/A2.java +package test2; + +import javax.annotation.*; + +public class A2 { + @Nullable public String field = null; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: main.kt +import test.A +import test2.A2 + +fun main(a: A, a2: A2) { + a.foo("", "", null)?.length + a.foo("", "", null).length + a.foo(null, null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a2.foo("", "", null)?.length + a2.foo("", "", null).length + a2.foo(null, null, "").length + + a2.bar().length + a2.bar()!!.length + + a2.field?.length + a2.field.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.fir.kt new file mode 100644 index 00000000000..76cbc408a2c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullable.fir.kt @@ -0,0 +1,79 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: spr/Nullable.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Target({ElementType.METHOD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierNickname +public @interface Nullable { +} + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) +public @interface NonNullApi { +} + +// FILE: A.java +import spr.*; + +@NonNullApi +public class A { + public String field = null; + + public String foo(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz().get(0) + a.baz()!!.get(0).get(0) + a.baz()!!.get(0)?.get(0) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.fir.kt new file mode 100644 index 00000000000..c900059bb65 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/springNullablePackage.fir.kt @@ -0,0 +1,84 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: spr/Nullable.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Target({ElementType.METHOD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierNickname +public @interface Nullable { +} + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.PACKAGE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) +public @interface NonNullApi { +} + +// FILE: test/package-info.java +@spr.NonNullApi() +package test; + +// FILE: test/A.java +package test; + +import spr.*; + +public class A { + public String field = null; + + public String foo(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } +} + +// FILE: main.kt +fun main(a: test.A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz().get(0) + a.baz()!!.get(0).get(0) + a.baz()!!.get(0)?.get(0) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt index 32ffb4af628..588221c4cd6 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/simple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt index 064b59cda33..a62f9e187a9 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/strange.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt index 788d127f3ba..6d0ac159677 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt index 5149c9d76a2..7b204e879a0 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.fir.kt new file mode 100644 index 00000000000..e566afc40ff --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibleOverOverrides.fir.kt @@ -0,0 +1,92 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) +public @interface NonNullApi { +} + +// FILE: spr/UnknownNullability.java +package spr; + +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.UNKNOWN) +@Retention(RetentionPolicy.RUNTIME) +public @interface UnknownNullability { + +} + +// FILE: spr/ForceFlexibility.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; +import javax.annotation.meta.When; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@UnknownNullability +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) +public @interface ForceFlexibility { +} + +// FILE: B.java +public interface B { + public void foo(@javax.annotation.Nonnull String x); + public void bar(@javax.annotation.Nonnull String x); + public void baz(@javax.annotation.Nonnull String x); + public void foobar(@javax.annotation.Nonnull String x); +} + +// FILE: A.java +import spr.*; + +@NonNullApi +public class A implements B { + @ForceFlexibility + public void foo(String x) {} + public void bar(@ForceFlexibility String x) {} + public void baz(@UnknownNullability String x) {} + public void foobar(@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) String x) {} +} + +// FILE: main.kt +fun main(a: A, b: B) { + b.foo(null) + b.bar(null) + b.baz(null) + b.foobar(null) + + a.foo(null) + a.bar(null) + a.baz(null) + a.foobar(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.fir.kt new file mode 100644 index 00000000000..cf8e5c6d141 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.fir.kt @@ -0,0 +1,152 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict + +// FILE: NonNullApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NonNullApi { +} + +// FILE: NullableApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NullableApi { +} + +// FILE: A.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public class A { + public String foo1(String x) { return ""; } + public String foo2(String x) { return ""; } + public String foo3(String x) { return ""; } + + + @Nullable + public String bar1(@Nullable String x) { return ""; } + @Nullable + public String bar2(@Nullable String x) { return ""; } + + public String baz(@Nonnull String x) { return ""; } +} + +// FILE: AInt.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public interface AInt { + public CharSequence foo1(String x); + public CharSequence foo2(String x); + public CharSequence foo3(String x); + + + @Nullable + public CharSequence bar1(@Nullable String x); + @Nullable + public CharSequence bar2(@Nullable String x); + + public CharSequence baz(@Nonnull String x); +} + + +// FILE: B.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NullableApi +public class B extends A implements AInt { + // conflicts + public String foo1(String x) { return ""; } + + // no conflicts + @Nonnull + public String foo2(@Nonnull String x) { return ""; } + + // fake override for foo3 shouldn't have any conflicts + + // no conflicts + public String bar1(String x) { return ""; } + + // conflicts + public String baz(String x) { return ""; } +} + +// FILE: C.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public class C extends A implements AInt { + // no conflicts + public String foo1(String x) { return ""; } + + // no conflicts + public String foo2(@Nonnull String x) { return ""; } + + // fake override for foo3 shouldn't have any conflicts + + // no conflicts, covariant override + public String bar1(String x) { return ""; } + // no conflicts + @Nullable + public String bar2(@Nullable String x) { return ""; } + + // no conflicts + public String baz(String x) { return ""; } +} + +// FILE: main.kt +fun main(a: A, b: B, c: C) { + a.foo1(null).length + a.foo2(null).length + a.foo3(null).length + a.bar1(null).length + a.bar2(null).length + a.baz(null).length + + b.foo1(null).length + b.foo1(null)?.length + b.foo2(null).length + b.foo3(null).length + b.bar1(null).length + b.bar2(null).length + b.baz(null).length + b.baz(null)?.length + + c.foo1(null).length + c.foo2(null).length + c.foo3(null).length + c.bar1(null).length + c.bar1(null)?.length + c.bar2(null).length + c.baz(null).length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.fir.kt new file mode 100644 index 00000000000..f9edb22b0d9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.fir.kt @@ -0,0 +1,181 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict + +// FILE: NonNullApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NonNullApi { +} + +// FILE: NullableApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) +public @interface NullableApi { +} + +// FILE: FieldsAreNullable.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.CheckForNull; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@CheckForNull +@TypeQualifierDefault({ElementType.FIELD}) +public @interface FieldsAreNullable { +} + +// FILE: A.java +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +@NonNullApi +public class A { + public String field = null; + + public String foo(String x, @CheckForNull CharSequence y) { + return ""; + } + + @NullableApi + public String foobar(String x, @NonNullApi CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } + + @NullableApi + public class B { + public String field = null; + + public String foo(String x, @Nonnull CharSequence y) { + return ""; + } + + @NonNullApi + public String foobar(String x, @NullableApi CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } + } + + @FieldsAreNullable + public class C { + public String field = null; + + public String foo(String x, @Nullable CharSequence y) { + return ""; + } + + @NullableApi + public String foobar(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } + } +} + +// FILE: main.kt +fun main(a: A, b: A.B, c: A.C) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.foobar(null, "").length + a.foobar("", null)?.length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz().get(0) + a.baz()!!.get(0).get(0) + a.baz()!!.get(0)?.get(0) + + // b + b.foo("", null)?.length + b.foo("", null).length + b.foo(null, "").length + + b.foobar(null, "").length + b.foobar("", null)?.length + + b.bar().length + b.bar()!!.length + + b.field?.length + b.field.length + + b.baz().get(0) + b.baz()!!.get(0).get(0) + b.baz()!!.get(0)?.get(0) + + // c + c.foo("", null)?.length + c.foo("", null).length + c.foo(null, "").length + + c.foobar(null, "").length + c.foobar("", null)?.length + + c.bar().length + c.bar()!!.length + + c.field?.length + c.field.length + + c.baz().get(0) + c.baz()!!.get(0).get(0) + c.baz()!!.get(0)?.get(0) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt index 7b2ae707bec..95e2e85e3a3 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefault.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt new file mode 100644 index 00000000000..0df5a9506be --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/parametersAreNonnullByDefaultPackage.fir.kt @@ -0,0 +1,70 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict + +// RENDER_PACKAGE: test, test2 + +// FILE: test/package-info.java +@javax.annotation.ParametersAreNonnullByDefault() +package test; + +// FILE: test/A.java +package test; + +import javax.annotation.*; + +public class A { + @Nullable public String field = null; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: test2/A2.java +package test2; + +import javax.annotation.*; + +public class A2 { + @Nullable public String field = null; + + public String foo(String q, @Nonnull String x, @CheckForNull CharSequence y) { + return ""; + } + + @Nonnull + public String bar() { + return ""; + } +} + +// FILE: main.kt +import test.A +import test2.A2 + +fun main(a: A, a2: A2) { + a.foo("", "", null)?.length + a.foo("", "", null).length + a.foo(null, null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a2.foo("", "", null)?.length + a2.foo("", "", null).length + a2.foo(null, null, "").length + + a2.bar().length + a2.bar()!!.length + + a2.field?.length + a2.field.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt index 1b732b442ac..e9929448649 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // JSR305_GLOBAL_REPORT: strict diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.fir.kt new file mode 100644 index 00000000000..f5c8074b5ed --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.fir.kt @@ -0,0 +1,85 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict +// RENDER_PACKAGE: test + +// FILE: spr/Nullable.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Target({ElementType.METHOD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull(when = When.MAYBE) +@TypeQualifierNickname +public @interface Nullable { +} + +// FILE: spr/NonNullApi.java +package spr; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +@Target(ElementType.PACKAGE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Nonnull +@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) +public @interface NonNullApi { +} + +// FILE: test/package-info.java +@spr.NonNullApi() +package test; + +// FILE: test/A.java +package test; + +import spr.*; + +public class A { + public String field = null; + + public String foo(String x, @Nullable CharSequence y) { + return ""; + } + + public String bar() { + return ""; + } + + @Nullable + public java.util.List baz() { + return null; + } +} + +// FILE: main.kt +fun main(a: test.A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz().get(0) + a.baz()!!.get(0).get(0) + a.baz()!!.get(0)?.get(0) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.fir.kt new file mode 100644 index 00000000000..1a55297c8d5 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/customMigration.fir.kt @@ -0,0 +1,82 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: ignore + +// FILE: MyErrorNonnull.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +import kotlin.annotations.jvm.*; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.ALWAYS) +@Retention(RetentionPolicy.RUNTIME) +@UnderMigration(status = MigrationStatus.STRICT) +public @interface MyErrorNonnull { +} + +// FILE: MyWarnNonnull.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +import kotlin.annotations.jvm.*; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.ALWAYS) +@Retention(RetentionPolicy.RUNTIME) +@UnderMigration(status = MigrationStatus.WARN) +public @interface MyWarnNonnull { +} + +// FILE: MyIgnoreNonnull.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +import kotlin.annotations.jvm.*; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.ALWAYS) +@Retention(RetentionPolicy.RUNTIME) +@UnderMigration(status = MigrationStatus.IGNORE) +public @interface MyIgnoreNonnull { +} + +// FILE: A.java +public class A { + public void foo(@MyErrorNonnull String bar) {} + public void foo2(@MyWarnNonnull String bar) {} + public void foo3(@MyIgnoreNonnull String bar) {} + public void foo4(@MyMigrationNonnull String bar) {} +} + +// FILE: main.kt +fun main(a: A) { + a.foo("") + a.foo(null) + + a.foo2("") + a.foo2(null) + + a.foo3("") + a.foo3(null) + + a.foo4("") + a.foo4(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.fir.kt new file mode 100644 index 00000000000..04865c891c4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalIgnore.fir.kt @@ -0,0 +1,55 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: ignore +// JSR305_MIGRATION_REPORT: strict +// JSR305_SPECIAL_REPORT: MyNonnull:warn + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyMigrationNonnull + public String bar() { + return ""; + } + + @MyNullable public String field2 = null; + @MyNullable + public String foo2(@MyNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + public String bar2() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.foo2("", null)?.length + a.foo2("", null).length + a.foo2(null, "").length + + a.bar2().length + a.bar2()!!.length + + a.field2?.length + a.field2.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.fir.kt new file mode 100644 index 00000000000..421316ce97d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/globalWarningMigrationIgnore.fir.kt @@ -0,0 +1,55 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn +// JSR305_MIGRATION_REPORT: ignore +// JSR305_SPECIAL_REPORT: MyNullable:strict, MyMigrationNonnull:strict + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyMigrationNonnull + public String bar() { + return ""; + } + + @MyNullable public String field2 = null; + @MyNullable + public String foo2(@MyNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + public String bar2() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.foo2("", null)?.length + a.foo2("", null).length + a.foo2(null, "").length + + a.bar2().length + a.bar2()!!.length + + a.field2?.length + a.field2.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.fir.kt new file mode 100644 index 00000000000..80159471ffa --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationError.fir.kt @@ -0,0 +1,76 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn +// JSR305_MIGRATION_REPORT: strict +// JSR305_SPECIAL_REPORT: MyNonnull:ignore, MySuperNull:strict + +// FILE: MySuperNull.java +import javax.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.meta.TypeQualifierNickname; +import javax.annotation.meta.When; + +@Documented +@TypeQualifierNickname +@Nonnull(when = When.MAYBE) +@Retention(RetentionPolicy.RUNTIME) +public @interface MySuperNull { +} + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyMigrationNonnull + public String bar() { + return ""; + } + + @MyNullable public String field2 = null; + @MyNullable + public String foo2(@MyNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + public String bar2() { + return ""; + } + + @MySuperNull public String field3 = null; +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.foo2("", null)?.length + a.foo2("", null).length + a.foo2(null, "").length + + a.bar2().length + a.bar2()!!.length + + a.field2?.length + a.field2.length + + a.field3?.length + a.field3.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.fir.kt new file mode 100644 index 00000000000..1d509401668 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationIgnore.fir.kt @@ -0,0 +1,55 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict +// JSR305_MIGRATION_REPORT: ignore +// JSR305_SPECIAL_REPORT: MyNullable:warn, MyMigrationNonnull:strict + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyMigrationNonnull + public String bar() { + return ""; + } + + @MyNullable public String field2 = null; + @MyNullable + public String foo2(@MyNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + public String bar2() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.foo2("", null)?.length + a.foo2("", null).length + a.foo2(null, "").length + + a.bar2().length + a.bar2()!!.length + + a.field2?.length + a.field2.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.fir.kt new file mode 100644 index 00000000000..e566e0eec0c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/migrationWarning.fir.kt @@ -0,0 +1,55 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: strict +// JSR305_MIGRATION_REPORT: warn +// JSR305_SPECIAL_REPORT: MyNullable:ignore, MyMigrationNullable:strict + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyMigrationNonnull + public String bar() { + return ""; + } + + @MyNullable public String field2 = null; + @MyNullable + public String foo2(@MyNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + public String bar2() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.foo2("", null)?.length + a.foo2("", null).length + a.foo2(null, "").length + + a.bar2().length + a.bar2()!!.length + + a.field2?.length + a.field2.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.fir.kt new file mode 100644 index 00000000000..b1d3fbd8950 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/overrideConflicts.fir.kt @@ -0,0 +1,85 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn +// JSR305_MIGRATION_REPORT: strict + +// FILE: A.java +import javax.annotation.Nullable; +import javax.annotation.Nonnull; + +public class A { + @MyNullable + public String foo() { return ""; } + + @MyMigrationNullable + public String foo2() { return ""; } + + @Nullable + public String foo3() { return ""; } + + public String foo4() { return ""; } + + public void bar(@MyNonnull String baz) { } + + public void bar2(@MyMigrationNonnull String baz) { } + + public void bar3(@Nonnull String baz) {} + + public void bar4(String baz) {} +} + +// FILE: B.java +public class B extends A { + @MyMigrationNullable + public String foo() { return ""; } + + @MyNullable + public String foo2() { return ""; } + + @MyNullable + public String foo3() { return ""; } + + @MyNullable + public String foo4() { return ""; } + + public void bar(@MyMigrationNonnull String baz) { } + + public void bar2(@MyNonnull String baz) { } + + public void bar3(@MyNonnull String baz) {} + + public void bar4(@MyNonnull String baz) {} +} + +// FILE: C.java +public class C extends A { + @MyMigrationNullable + public String foo4() { return ""; } + + public void bar4(@MyMigrationNonnull String baz) {} +} + +// FILE: main.kt +fun main(b: B, c: C) { + b.foo().length + b.foo()?.length + b.foo2().length + b.foo2()?.length + b.foo3().length + b.foo3()?.length + b.foo4().length + b.foo4()?.length + + b.bar(null) + b.bar("") + b.bar2(null) + b.bar2("") + b.bar3(null) + b.bar3("") + b.bar4(null) + b.bar4("") + + c.foo4().length + c.foo4()?.length + c.bar4(null) + c.bar4("") +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.fir.kt new file mode 100644 index 00000000000..2a8cb0599da --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/specialCollision.fir.kt @@ -0,0 +1,35 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: ignore +// JSR305_MIGRATION_REPORT: ignore +// JSR305_SPECIAL_REPORT: MyNonnull:warn, MyMigrationNonnull:strict + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + @MyMigrationNonnull + public String bar() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.fir.kt new file mode 100644 index 00000000000..6b1b998832d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305NullabilityWarnings/migration/stateRefinement.fir.kt @@ -0,0 +1,55 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: ignore +// JSR305_MIGRATION_REPORT: warn +// JSR305_SPECIAL_REPORT: MyNonnull:strict + +// FILE: A.java +import javax.annotation.*; + +public class A { + @MyMigrationNullable public String field = null; + + @MyMigrationNullable + public String foo(@MyMigrationNonnull String x, CharSequence y) { + return ""; + } + + @MyMigrationNonnull + public String bar() { + return ""; + } + + @MyNullable public String field2 = null; + @MyNullable + public String foo2(@MyNonnull String x, CharSequence y) { + return ""; + } + + @MyNonnull + public String bar2() { + return ""; + } +} + +// FILE: main.kt +fun main(a: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.foo2("", null)?.length + a.foo2("", null).length + a.foo2(null, "").length + + a.bar2().length + a.bar2()!!.length + + a.field2?.length + a.field2.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt index 5aef0474858..35f386ff5e0 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47833.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: main.kt sealed class ClientBootResult diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt index baaede4d2a9..4329a426411 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt47920.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // MUTE_FOR_PSI_CLASS_FILES_READING // FILE: J1.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt index d264d4cb1ff..43be1c1b000 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.fir.kt new file mode 100644 index 00000000000..68868a2d3d3 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/multiple.fir.kt @@ -0,0 +1,158 @@ +// NULLABILITY_ANNOTATIONS: @io.reactivex.annotations:strict, @org.eclipse.jdt.annotation:warn, @androidx.annotation:strict, @com.android.annotations:ignore + +// FILE: A1.java +import io.reactivex.annotations.*; + +public class A1 { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: A2.java +import org.eclipse.jdt.annotation.*; + +public class A2 { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: A3.java +import androidx.annotation.*; + +public class A3 { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: A4.java +import com.android.annotations.*; + +public class A4 { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: main.kt +fun main1(a: A1, a1: A1) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} + +fun main2(a: A2, a1: A2) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} + +fun main3(a: A3, a1: A3) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} + +fun main4(a: A4, a1: A4) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt index 0e86c2a59e0..6def6bcc69a 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.fir.kt new file mode 100644 index 00000000000..d89f6f6ddfc --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Default.fir.kt @@ -0,0 +1,41 @@ +// FILE: A.java + +import io.reactivex.rxjava3.annotations.*; + +public class A { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: main.kt + +fun main(a: A, a1: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt index 62e1733a9e7..ddf2dc61261 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Errors.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NULLABILITY_ANNOTATIONS: @io.reactivex.rxjava3.annotations:strict // FILE: A.java @@ -40,4 +41,4 @@ fun main(a: A, a1: A) { a1.baz("")!!.length a1.baz(null)!!.length -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.fir.kt new file mode 100644 index 00000000000..def10dff864 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Ignore.fir.kt @@ -0,0 +1,43 @@ +// NULLABILITY_ANNOTATIONS: @io.reactivex.rxjava3.annotations:ignore + +// FILE: A.java + +import io.reactivex.rxjava3.annotations.*; + +public class A { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: main.kt + +fun main(a: A, a1: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.fir.kt new file mode 100644 index 00000000000..9596f8e58c0 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/rxjava3Warnings.fir.kt @@ -0,0 +1,43 @@ +// NULLABILITY_ANNOTATIONS: @io.reactivex.rxjava3.annotations:warn + +// FILE: A.java + +import io.reactivex.rxjava3.annotations.*; + +public class A { + @Nullable public String field = null; + + @Nullable + public String foo(@NonNull String x, @Nullable CharSequence y) { + return ""; + } + + @NonNull + public String bar() { + return ""; + } + + @Nullable + public T baz(@NonNull T x) { return x; } +} + +// FILE: main.kt + +fun main(a: A, a1: A) { + a.foo("", null)?.length + a.foo("", null).length + a.foo(null, "").length + + a.bar().length + a.bar()!!.length + + a.field?.length + a.field.length + + a.baz("").length + a.baz("")?.length + a.baz(null).length + + a1.baz("")!!.length + a1.baz(null)!!.length +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.fir.kt new file mode 100644 index 00000000000..b9dd9a44a77 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/typeQualifierDefault/defaultAndNicknameMigrationPolicy.fir.kt @@ -0,0 +1,64 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// JSR305_GLOBAL_REPORT: warn + +// FILE: NonNullApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.meta.TypeQualifierDefault; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@MyNonnull +@TypeQualifierDefault({ ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD }) +public @interface NonNullApi { +} + +// FILE: MigrationNonNullApi.java +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.meta.TypeQualifierDefault; + +import kotlin.annotations.jvm.*; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@MyNonnull +@UnderMigration(status = MigrationStatus.STRICT) +@TypeQualifierDefault({ ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD }) +public @interface MigrationNonNullApi { +} + +// FILE: PolicyFromDefault.java +@NonNullApi +public class PolicyFromDefault { + public String foo(String x) { + return x; + } + + public String bar = "bar"; +} + +// FILE: PolicyFromNickname.java +@MigrationNonNullApi +public class PolicyFromNickname { + public String foo(String x) { + return x; + } + + public String bar = "bar"; +} + +// FILE: main.kt +fun main(default: PolicyFromDefault, nickname: PolicyFromNickname) { + default.foo(null).length + default.foo("hello").length + + nickname.foo(null).length + nickname.foo("hello").length +} diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt index dd2f4ceb74c..e834651e10c 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt @@ -154,6 +154,30 @@ fun generateJUnit5CompilerTests(args: Array) { model("diagnostics/tests", excludedPattern = excludedFirTestdataPattern) model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern) } + + testClass( + suiteTestClassName = "FirOldFrontendForeignAnnotationsSourceJavaTestGenerated" + ) { + model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern) + model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern) + model("diagnostics/foreignAnnotationsTests/java9Tests", excludedPattern = excludedFirTestdataPattern) + } + + testClass( + suiteTestClassName = "FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated" + ) { + model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern) + model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern) + model("diagnostics/foreignAnnotationsTests/java9Tests", excludedPattern = excludedFirTestdataPattern) + } + + testClass( + suiteTestClassName = "FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated" + ) { + model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern) + model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern) + model("diagnostics/foreignAnnotationsTests/java9Tests", excludedPattern = excludedFirTestdataPattern) + } } testGroup(testsRoot = "compiler/fir/fir2ir/tests-gen", testDataRoot = "compiler/testData") {