From 671480ce1a568046ffd8ae6b81457f4793617b61 Mon Sep 17 00:00:00 2001 From: Kevin Bourrillion Date: Mon, 12 Dec 2022 19:00:05 -0800 Subject: [PATCH] Duplicate this entire test suite to `jspecifyOld` before changing the package locations in `jspecify`. --- ...nAnnotationsCompiledJavaTestGenerated.java | 388 ++++++++++++++++++ ...dJavaWithPsiClassReadingTestGenerated.java | 388 ++++++++++++++++++ ...ignAnnotationsSourceJavaTestGenerated.java | 388 ++++++++++++++++++ .../moduleAnnotations/strict/basic.kt | 26 ++ .../moduleAnnotations/strict/basic.txt | 14 + .../composeWithClassDefaultAnnotation.kt | 29 ++ .../composeWithClassDefaultAnnotation.txt | 15 + .../composeWithPackageDefaultAnnotation.kt | 32 ++ .../composeWithPackageDefaultAnnotation.txt | 15 + .../strict/dependentModulesNoNullMarked.kt | 31 ++ .../strict/dependentModulesNoNullMarked.txt | 20 + .../strict/dependentModulesNullMarked.kt | 31 ++ .../strict/dependentModulesNullMarked.txt | 20 + ...nnotationToAnotherModuleWithSamePackage.kt | 45 ++ ...notationToAnotherModuleWithSamePackage.txt | 29 ++ .../strict/dotNamedModule.kt | 26 ++ .../strict/dotNamedModule.txt | 18 + .../strict/inheritanceAcrossModules.kt | 46 +++ .../strict/inheritanceAcrossModules.txt | 31 ++ .../moduleAnnotations/strict/nestedClasses.kt | 44 ++ .../strict/nestedClasses.txt | 54 +++ .../strict/overrideAtDeclarationLevel.kt | 28 ++ .../strict/overrideAtDeclarationLevel.txt | 15 + .../strict/severalModulesDifferentPackages.kt | 40 ++ .../severalModulesDifferentPackages.txt | 30 ++ .../moduleAnnotations/warn/basic.fir.kt | 25 ++ .../moduleAnnotations/warn/basic.kt | 25 ++ .../moduleAnnotations/warn/basic.txt | 14 + .../composeWithClassDefaultAnnotation.fir.kt | 28 ++ .../warn/composeWithClassDefaultAnnotation.kt | 28 ++ .../composeWithClassDefaultAnnotation.txt | 15 + ...composeWithPackageDefaultAnnotation.fir.kt | 31 ++ .../composeWithPackageDefaultAnnotation.kt | 31 ++ .../composeWithPackageDefaultAnnotation.txt | 15 + .../warn/dependentModulesNoNullMarked.kt | 31 ++ .../warn/dependentModulesNoNullMarked.txt | 20 + .../warn/dependentModulesNullMarked.fir.kt | 30 ++ .../warn/dependentModulesNullMarked.kt | 30 ++ .../warn/dependentModulesNullMarked.txt | 20 + ...nnotationToAnotherModuleWithSamePackage.kt | 45 ++ ...notationToAnotherModuleWithSamePackage.txt | 29 ++ .../warn/dotNamedModule.fir.kt | 25 ++ .../moduleAnnotations/warn/dotNamedModule.kt | 25 ++ .../moduleAnnotations/warn/dotNamedModule.txt | 18 + .../warn/inheritanceAcrossModules.fir.kt | 45 ++ .../warn/inheritanceAcrossModules.kt | 45 ++ .../warn/inheritanceAcrossModules.txt | 31 ++ .../warn/nestedClasses.fir.kt | 43 ++ .../moduleAnnotations/warn/nestedClasses.kt | 43 ++ .../moduleAnnotations/warn/nestedClasses.txt | 54 +++ .../warn/overrideAtDeclarationLevel.kt | 29 ++ .../warn/overrideAtDeclarationLevel.txt | 15 + .../severalModulesDifferentPackages.fir.kt | 39 ++ .../warn/severalModulesDifferentPackages.kt | 39 ++ .../warn/severalModulesDifferentPackages.txt | 30 ++ .../java8Tests/jspecifyOld/default.fir.kt | 36 ++ .../java8Tests/jspecifyOld/default.kt | 36 ++ .../java8Tests/jspecifyOld/default.txt | 19 + .../AnnotatedBoundsOfWildcard.fir.kt | 90 ++++ .../strictMode/AnnotatedBoundsOfWildcard.kt | 90 ++++ .../strictMode/AnnotatedBoundsOfWildcard.txt | 39 ++ .../jspecifyOld/strictMode/Captured.kt | 18 + .../jspecifyOld/strictMode/Captured.txt | 18 + .../jspecifyOld/strictMode/Defaults.kt | 52 +++ .../jspecifyOld/strictMode/Defaults.txt | 26 ++ .../strictMode/IgnoreAnnotations.kt | 50 +++ .../strictMode/IgnoreAnnotations.txt | 32 ++ .../strictMode/NonPlatformTypeParameter.kt | 31 ++ .../strictMode/NonPlatformTypeParameter.txt | 20 + .../NullnessUnspecifiedTypeParameter.fir.kt | 38 ++ .../NullnessUnspecifiedTypeParameter.kt | 38 ++ .../NullnessUnspecifiedTypeParameter.txt | 20 + .../jspecifyOld/strictMode/SelfType.fir.kt | 58 +++ .../jspecifyOld/strictMode/SelfType.kt | 58 +++ .../jspecifyOld/strictMode/SelfType.txt | 68 +++ .../jspecifyOld/strictMode/Simple.kt | 41 ++ .../jspecifyOld/strictMode/Simple.txt | 29 ++ .../TypeArgumentsFromParameterBounds.fir.kt | 49 +++ .../TypeArgumentsFromParameterBounds.kt | 49 +++ .../TypeArgumentsFromParameterBounds.txt | 34 ++ .../strictMode/TypeParameterBounds.fir.kt | 47 +++ .../strictMode/TypeParameterBounds.kt | 47 +++ .../strictMode/TypeParameterBounds.txt | 29 ++ .../strictMode/UnannotatedWildcard.fir.kt | 18 + .../strictMode/UnannotatedWildcard.kt | 18 + .../strictMode/UnannotatedWildcard.txt | 17 + .../strictMode/WildcardsWithDefault.kt | 36 ++ .../strictMode/WildcardsWithDefault.txt | 20 + .../jspecifyOld/strictMode/kt47396.kt | 23 ++ .../jspecifyOld/strictMode/kt47396.txt | 16 + .../jspecifyOld/strictMode/kt47422.fir.kt | 137 +++++++ .../jspecifyOld/strictMode/kt47422.kt | 137 +++++++ .../jspecifyOld/strictMode/kt47422.txt | 87 ++++ .../jspecifyOld/strictMode/kt47437.kt | 19 + .../jspecifyOld/strictMode/kt47437.txt | 14 + .../jspecifyOld/strictMode/kt48261.kt | 35 ++ .../jspecifyOld/strictMode/kt48261.txt | 75 ++++ .../warnMode/AnnotatedBoundsOfWildcard.fir.kt | 89 ++++ .../warnMode/AnnotatedBoundsOfWildcard.kt | 89 ++++ .../warnMode/AnnotatedBoundsOfWildcard.txt | 39 ++ .../jspecifyOld/warnMode/Captured.kt | 18 + .../jspecifyOld/warnMode/Captured.txt | 18 + .../jspecifyOld/warnMode/Defaults.fir.kt | 50 +++ .../jspecifyOld/warnMode/Defaults.kt | 50 +++ .../jspecifyOld/warnMode/Defaults.txt | 26 ++ .../warnMode/IgnoreAnnotations.fir.kt | 48 +++ .../jspecifyOld/warnMode/IgnoreAnnotations.kt | 48 +++ .../warnMode/IgnoreAnnotations.txt | 32 ++ .../warnMode/NonPlatformTypeParameter.fir.kt | 30 ++ .../warnMode/NonPlatformTypeParameter.kt | 30 ++ .../warnMode/NonPlatformTypeParameter.txt | 20 + .../NullnessUnspecifiedTypeParameter.fir.kt | 37 ++ .../NullnessUnspecifiedTypeParameter.kt | 37 ++ .../NullnessUnspecifiedTypeParameter.txt | 20 + .../warnMode/OverrideOfAnnotated.fir.kt | 79 ++++ .../warnMode/OverrideOfAnnotated.kt | 79 ++++ .../warnMode/OverrideOfAnnotated.txt | 57 +++ .../jspecifyOld/warnMode/SelfType.fir.kt | 57 +++ .../jspecifyOld/warnMode/SelfType.kt | 57 +++ .../jspecifyOld/warnMode/SelfType.txt | 68 +++ .../jspecifyOld/warnMode/Simple.fir.kt | 39 ++ .../java8Tests/jspecifyOld/warnMode/Simple.kt | 39 ++ .../jspecifyOld/warnMode/Simple.txt | 29 ++ .../TypeArgumentsFromParameterBounds.fir.kt | 48 +++ .../TypeArgumentsFromParameterBounds.kt | 48 +++ .../TypeArgumentsFromParameterBounds.txt | 34 ++ .../warnMode/TypeParameterBounds.fir.kt | 46 +++ .../warnMode/TypeParameterBounds.kt | 46 +++ .../warnMode/TypeParameterBounds.txt | 29 ++ .../warnMode/UnannotatedWildcard.kt | 17 + .../warnMode/UnannotatedWildcard.txt | 17 + .../warnMode/WildcardsWithDefault.kt | 36 ++ .../warnMode/WildcardsWithDefault.txt | 20 + .../jspecifyOld/warnMode/kt47899.fir.kt | 15 + .../jspecifyOld/warnMode/kt47899.kt | 15 + .../jspecifyOld/warnMode/kt47899.txt | 13 + ...nAnnotationsCompiledJavaTestGenerated.java | 388 ++++++++++++++++++ ...dJavaWithPsiClassReadingTestGenerated.java | 388 ++++++++++++++++++ ...ignAnnotationsSourceJavaTestGenerated.java | 388 ++++++++++++++++++ 139 files changed, 7248 insertions(+) create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.txt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.txt 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 index 711c91e22db..75ddf515eef 100644 --- 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 @@ -840,6 +840,222 @@ public class FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated extends A } } + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("kt48261.kt") + public void testKt48261() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("OverrideOfAnnotated.kt") + public void testOverrideOfAnnotated() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") @TestDataPath("$PROJECT_ROOT") @@ -1197,5 +1413,177 @@ public class FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated extends A } } } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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 index ef268fefc9e..0061da4d300 100644 --- 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 @@ -840,6 +840,222 @@ public class FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTest } } + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("kt48261.kt") + public void testKt48261() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("OverrideOfAnnotated.kt") + public void testOverrideOfAnnotated() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") @TestDataPath("$PROJECT_ROOT") @@ -1197,5 +1413,177 @@ public class FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTest } } } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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 index 80e7425ced9..caaa06392f7 100644 --- 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 @@ -840,6 +840,222 @@ public class FirOldFrontendForeignAnnotationsSourceJavaTestGenerated extends Abs } } + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("kt48261.kt") + public void testKt48261() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("OverrideOfAnnotated.kt") + public void testOverrideOfAnnotated() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") @TestDataPath("$PROJECT_ROOT") @@ -1197,5 +1413,177 @@ public class FirOldFrontendForeignAnnotationsSourceJavaTestGenerated extends Abs } } } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } } } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt new file mode 100644 index 00000000000..f92df8709bf --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt @@ -0,0 +1,26 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.txt new file mode 100644 index 00000000000..2c0728284ce --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.txt @@ -0,0 +1,14 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt new file mode 100644 index 00000000000..8fe4f23b447 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt @@ -0,0 +1,29 @@ +// FIR_IDENTICAL +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// 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/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.txt new file mode 100644 index 00000000000..c110723f194 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.txt @@ -0,0 +1,15 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + @org.jspecify.nullness.NullMarked public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt new file mode 100644 index 00000000000..9441aca3cbd --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt @@ -0,0 +1,32 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.txt new file mode 100644 index 00000000000..224b6b6d5d7 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.txt @@ -0,0 +1,15 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt new file mode 100644 index 00000000000..400a55791e4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt @@ -0,0 +1,31 @@ +// FIR_IDENTICAL +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// MODULE: module1 +// FILE: module1/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module1 { + requires java9_annotations; +} + +// 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(y: test2.Test) { + y.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.txt new file mode 100644 index 00000000000..cdba12947a6 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.txt @@ -0,0 +1,20 @@ +// -- Module: -- +package + + +// -- Module: -- +package + +public fun main(/*0*/ y: test2.Test): kotlin.Unit + +package test2 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt new file mode 100644 index 00000000000..dba69d55fd8 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt @@ -0,0 +1,31 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.txt new file mode 100644 index 00000000000..b5db4a1f4ad --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.txt @@ -0,0 +1,20 @@ +// -- Module: -- +package + + +// -- Module: -- +package + +public fun main(/*0*/ y: test2.Test): kotlin.Unit + +package test2 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt new file mode 100644 index 00000000000..394b4edbe35 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt @@ -0,0 +1,45 @@ +// FIR_IDENTICAL +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// MODULE: sandbox +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/package-info.java +package test; + +// FILE: sandbox/test/Foo.java +package test; + +class Foo {} + +// MODULE: sandbox2 +// FILE: sandbox2/module-info.java +module sandbox2 { + requires java9_annotations; + exports test; +} + +// FILE: sandbox2/test/package-info.java +package test; + +// FILE: sandbox2/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/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt new file mode 100644 index 00000000000..8ecab7ee55c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt @@ -0,0 +1,29 @@ +// -- Module: -- +package + +package test { + + public/*package*/ open class Foo { + public/*package*/ constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt new file mode 100644 index 00000000000..83e8d555711 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt @@ -0,0 +1,26 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.txt new file mode 100644 index 00000000000..f09de9d10a4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.txt @@ -0,0 +1,18 @@ +package + +public fun main(/*0*/ x: my.test.Test): kotlin.Unit + +package my { + + package my.test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt new file mode 100644 index 00000000000..32f805ed76e --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt @@ -0,0 +1,46 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.txt new file mode 100644 index 00000000000..842e966d40c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.txt @@ -0,0 +1,31 @@ +// -- Module: -- +package + +package test1 { + + public open class Test1 { + public constructor Test1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun main(/*0*/ x: test1.Test1, /*1*/ y: test2.Test2): kotlin.Unit + +package test2 { + + public open class Test2 : test1.Test1 { + public constructor Test2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: kotlin.Int): kotlin.Unit + public open fun foo2(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt new file mode 100644 index 00000000000..d682d599047 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt @@ -0,0 +1,44 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.txt new file mode 100644 index 00000000000..644d975dbe5 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.txt @@ -0,0 +1,54 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public open class Test2 { + public constructor Test2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public open class Test4 { + public constructor Test4() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public open inner class Test5 { + public constructor Test5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + public open inner class Test3 { + public constructor Test3() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public open inner class Test5 { + public constructor Test5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt new file mode 100644 index 00000000000..fbf83768f19 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt @@ -0,0 +1,28 @@ +// FIR_IDENTICAL +// ALLOW_KOTLIN_PACKAGE +// JSPECIFY_STATE: strict + +// 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.Nullable; + +public class Test { + public void foo(@Nullable Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.txt new file mode 100644 index 00000000000..bf64fb83fac --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.txt @@ -0,0 +1,15 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable kotlin.Int?): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt new file mode 100644 index 00000000000..245ddbfc41e --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt @@ -0,0 +1,40 @@ +// FIR_IDENTICAL +// 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.txt new file mode 100644 index 00000000000..aae9804ec80 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.txt @@ -0,0 +1,30 @@ +// -- Module: -- +package + +package test1 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun main(/*0*/ x: test1.Test, /*1*/ y: test2.Test): kotlin.Unit + +package test2 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.fir.kt new file mode 100644 index 00000000000..140f5cd7446 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt new file mode 100644 index 00000000000..3064e8cf940 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.txt new file mode 100644 index 00000000000..faca03d295c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.txt @@ -0,0 +1,14 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.fir.kt new file mode 100644 index 00000000000..f04a05cbad9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt new file mode 100644 index 00000000000..927b4c03a21 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.txt new file mode 100644 index 00000000000..ed7d8b2b4da --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.txt @@ -0,0 +1,15 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + @org.jspecify.nullness.NullMarked public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.fir.kt new file mode 100644 index 00000000000..a8c6dea1146 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt new file mode 100644 index 00000000000..918d2e91a41 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.txt new file mode 100644 index 00000000000..0f345e39f15 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.txt @@ -0,0 +1,15 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt new file mode 100644 index 00000000000..6bb0013d7e1 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt @@ -0,0 +1,31 @@ +// FIR_IDENTICAL +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// MODULE: module1 +// FILE: module1/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module module1 { + requires java9_annotations; +} + +// 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(y: test2.Test) { + y.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.txt new file mode 100644 index 00000000000..cdba12947a6 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.txt @@ -0,0 +1,20 @@ +// -- Module: -- +package + + +// -- Module: -- +package + +public fun main(/*0*/ y: test2.Test): kotlin.Unit + +package test2 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.fir.kt new file mode 100644 index 00000000000..5a18583c504 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt new file mode 100644 index 00000000000..aa959d1c5aa --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.txt new file mode 100644 index 00000000000..cdba12947a6 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.txt @@ -0,0 +1,20 @@ +// -- Module: -- +package + + +// -- Module: -- +package + +public fun main(/*0*/ y: test2.Test): kotlin.Unit + +package test2 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt new file mode 100644 index 00000000000..e7726d31e69 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt @@ -0,0 +1,45 @@ +// FIR_IDENTICAL +// JSPECIFY_STATE: warn +// ALLOW_KOTLIN_PACKAGE + +// MODULE: sandbox +// FILE: sandbox/module-info.java +import org.jspecify.nullness.NullMarked; + +@NullMarked +module sandbox { + requires java9_annotations; + exports test; +} + +// FILE: sandbox/test/package-info.java +package test; + +// FILE: sandbox/test/Foo.java +package test; + +class Foo {} + +// MODULE: sandbox2 +// FILE: sandbox2/module-info.java +module sandbox2 { + requires java9_annotations; + exports test; +} + +// FILE: sandbox2/test/package-info.java +package test; + +// FILE: sandbox2/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/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt new file mode 100644 index 00000000000..8ecab7ee55c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.txt @@ -0,0 +1,29 @@ +// -- Module: -- +package + +package test { + + public/*package*/ open class Foo { + public/*package*/ constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.fir.kt new file mode 100644 index 00000000000..a6833e397c4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt new file mode 100644 index 00000000000..da2694b8fd5 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.txt new file mode 100644 index 00000000000..0756c89d246 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.txt @@ -0,0 +1,18 @@ +package + +public fun main(/*0*/ x: my.test.Test): kotlin.Unit + +package my { + + package my.test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.fir.kt new file mode 100644 index 00000000000..b3a6eb69c54 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt new file mode 100644 index 00000000000..1611806de25 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.txt new file mode 100644 index 00000000000..fce457e7676 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.txt @@ -0,0 +1,31 @@ +// -- Module: -- +package + +package test1 { + + public open class Test1 { + public constructor Test1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun main(/*0*/ x: test1.Test1, /*1*/ y: test2.Test2): kotlin.Unit + +package test2 { + + public open class Test2 : test1.Test1 { + public constructor Test2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: kotlin.Int!): kotlin.Unit + public open fun foo2(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.fir.kt new file mode 100644 index 00000000000..1e674e3e15a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt new file mode 100644 index 00000000000..00573def489 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.txt new file mode 100644 index 00000000000..e5857d9793f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.txt @@ -0,0 +1,54 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public open class Test2 { + public constructor Test2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public open class Test4 { + public constructor Test4() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public open inner class Test5 { + public constructor Test5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + public open inner class Test3 { + public constructor Test3() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public open inner class Test5 { + public constructor Test5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt new file mode 100644 index 00000000000..1f42a680414 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt @@ -0,0 +1,29 @@ +// FIR_IDENTICAL +// FIR_IDENTICAL +// 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.Nullable; + +public class Test { + public void foo(@Nullable Integer x) {} +} + +// FILE: main.kt +import test.Test + +fun main(x: Test) { + x.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.txt new file mode 100644 index 00000000000..f73f078d963 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.txt @@ -0,0 +1,15 @@ +package + +public fun main(/*0*/ x: test.Test): kotlin.Unit + +package test { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.fir.kt new file mode 100644 index 00000000000..5e99d57f9fe --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/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/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt new file mode 100644 index 00000000000..b344c490418 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.txt new file mode 100644 index 00000000000..f16e1e80fd2 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.txt @@ -0,0 +1,30 @@ +// -- Module: -- +package + +package test1 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun main(/*0*/ x: test1.Test, /*1*/ y: test2.Test): kotlin.Unit + +package test2 { + + public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.fir.kt new file mode 100644 index 00000000000..530b7425695 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.fir.kt @@ -0,0 +1,36 @@ +// 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 +// jspecify_nullness_mismatch +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter, x: Test): Unit { + // jspecify_nullness_mismatch + a1.foo(null) + a1.foo(1) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.foo(1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar(null, null) + // jspecify_nullness_mismatch + a1.bar(x, null) + a1.bar(x, 1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar(null, null) + // jspecify_nullness_mismatch + a2.bar(x, null) + a2.bar(x, 1) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt new file mode 100644 index 00000000000..7b05a230ea9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt @@ -0,0 +1,36 @@ +// 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 +// jspecify_nullness_mismatch +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter<Any?>, x: Test): Unit { + // jspecify_nullness_mismatch + a1.foo(null) + a1.foo(1) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.foo(1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar(null, null) + // jspecify_nullness_mismatch + a1.bar(x, null) + a1.bar(x, 1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar(null, null) + // jspecify_nullness_mismatch + a2.bar(x, null) + a2.bar(x, 1) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.txt new file mode 100644 index 00000000000..163bebaf51d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.txt @@ -0,0 +1,19 @@ +package + +public fun main(/*0*/ a1: NullnessUnspecifiedTypeParameter, /*1*/ a2: NullnessUnspecifiedTypeParameter, /*2*/ x: Test): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class NullnessUnspecifiedTypeParameter { + public constructor NullnessUnspecifiedTypeParameter() + public open fun bar(/*0*/ s: Test!, /*1*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.fir.kt new file mode 100644 index 00000000000..f9a2370fdba --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.fir.kt @@ -0,0 +1,90 @@ +// 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 { + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNull) + b.superAsIs(aAnyNotNullNullNotNull) + b.superAsIs(aAnyNotNullNullNull) + + b.superNotNull(aAnyNotNullNotNullNotNull) + b.superNotNull(aAnyNotNullNotNullNull) + b.superNotNull(aAnyNotNullNullNotNull) + b.superNotNull(aAnyNotNullNullNull) + + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNull) + + b.extendsAsIs(aNotNullNotNullNotNull) + b.extendsAsIs(aNotNullNotNullNull) + b.extendsAsIs(aNotNullNullNotNull) + b.extendsAsIs(aNotNullNullNull) + + b.extendsNotNull(aNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNotNullNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNullNotNull) + // jspecify_nullness_mismatch + 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/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt new file mode 100644 index 00000000000..a62cdf6955b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt @@ -0,0 +1,90 @@ +// 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 { + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNull) + b.superAsIs(aAnyNotNullNullNotNull) + b.superAsIs(aAnyNotNullNullNull) + + b.superNotNull(aAnyNotNullNotNullNotNull) + b.superNotNull(aAnyNotNullNotNullNull) + b.superNotNull(aAnyNotNullNullNotNull) + b.superNotNull(aAnyNotNullNullNull) + + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNull) + + b.extendsAsIs(aNotNullNotNullNotNull) + b.extendsAsIs(aNotNullNotNullNull) + b.extendsAsIs(aNotNullNullNotNull) + b.extendsAsIs(aNotNullNullNull) + + b.extendsNotNull(aNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNotNullNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNullNotNull) + // jspecify_nullness_mismatch + 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.txt new file mode 100644 index 00000000000..f1c2da5e670 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.txt @@ -0,0 +1,39 @@ +package + +public fun main(/*0*/ aNotNullNotNullNotNull: Test, /*1*/ aNotNullNotNullNull: Test, /*2*/ aNotNullNullNotNull: Test, /*3*/ aNotNullNullNull: Test, /*4*/ aAnyNotNullNotNullNotNull: Test, /*5*/ aAnyNotNullNotNullNull: Test, /*6*/ aAnyNotNullNullNotNull: Test, /*7*/ aAnyNotNullNullNull: Test, /*8*/ b: AnnotatedBoundsOfWildcard): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class AnnotatedBoundsOfWildcard { + public constructor AnnotatedBoundsOfWildcard() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun extendsAsIs(/*0*/ a: Test): kotlin.Unit + public open fun extendsNotNull(/*0*/ a: Test): kotlin.Unit + public open fun extendsNullable(/*0*/ a: Test): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open fun noBounds(/*0*/ a: Test): kotlin.Unit + public open fun superAsIs(/*0*/ a: Test): kotlin.Unit + public open fun superNotNull(/*0*/ a: Test): kotlin.Unit + public open fun superNullable(/*0*/ a: Test): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Derived : Base { + public constructor Derived() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt new file mode 100644 index 00000000000..f0aa0bebf42 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt @@ -0,0 +1,18 @@ +// FIR_IDENTICAL +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +// FILE: J1.java +import org.jetbrains.annotations.Nullable; + +public interface J1 { + @Nullable + public static T foo(J1 x) { return null; } +} + +// FILE: J2.java +import org.jspecify.nullness.Nullable; + +public interface J2 extends J1 { } + +// FILE: kotlin.kt +private fun J2<*>.bar() = J1.foo(this) \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.txt new file mode 100644 index 00000000000..a30bd47201f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.txt @@ -0,0 +1,18 @@ +package + +private fun J2<*>.bar(): @org.jspecify.nullness.Nullable kotlin.Any? + +public interface J1 { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + @org.jetbrains.annotations.Nullable public open fun foo(/*0*/ x: J1!): @org.jetbrains.annotations.Nullable T? +} + +public interface J2 : J1 { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt new file mode 100644 index 00000000000..66aeaa48b26 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt @@ -0,0 +1,52 @@ +// FIR_IDENTICAL +// 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 { + // jspecify_nullness_mismatch + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + // jspecify_nullness_mismatch + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.mixed(null).foo() + // jspecify_nullness_mismatch + a.mixed(x).foo() + + a.explicitlyNullnessUnspecified(x).foo() + a.explicitlyNullnessUnspecified(null).foo() + + a.defaultField.foo() + + // jspecify_nullness_mismatch + a.field.foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.txt new file mode 100644 index 00000000000..b68c64fe3a0 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.txt @@ -0,0 +1,26 @@ +package + +public fun main(/*0*/ a: Defaults, /*1*/ x: Foo): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class Defaults { + public constructor Defaults() + public final var defaultField: Foo + @org.jspecify.nullness.Nullable public final var field: @org.jspecify.nullness.Nullable Foo? + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun everythingNotNullable(/*0*/ x: Foo): Foo + @org.jspecify.nullness.Nullable public open fun everythingNullable(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable Foo?): @org.jspecify.nullness.Nullable Foo? + @org.jspecify.nullness.NullnessUnspecified public open fun everythingUnknown(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): @org.jspecify.nullness.NullnessUnspecified Foo! + public open fun explicitlyNullnessUnspecified(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): Foo + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + @org.jspecify.nullness.Nullable public open fun mixed(/*0*/ x: Foo): @org.jspecify.nullness.Nullable Foo? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Foo { + public constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(): kotlin.Any! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt new file mode 100644 index 00000000000..0d24a58285e --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt @@ -0,0 +1,50 @@ +// FIR_IDENTICAL +// 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 { + // jspecify_nullness_mismatch + a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.foo(null, x).foo() + + // jspecify_nullness_mismatch + a.field.foo() + + // jspecify_nullness_mismatch + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + // jspecify_nullness_mismatch + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.txt new file mode 100644 index 00000000000..10890003f07 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.txt @@ -0,0 +1,32 @@ +package + +public fun main(/*0*/ a: IgnoreAnnotations, /*1*/ x: Derived): kotlin.Unit + +public open class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Derived : Base { + public constructor Derived() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class IgnoreAnnotations { + public constructor IgnoreAnnotations() + @org.jspecify.nullness.Nullable public final var field: @org.jspecify.nullness.Nullable Derived? + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun everythingNotNullable(/*0*/ x: Derived): Derived + @org.jspecify.nullness.Nullable public open fun everythingNullable(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable Derived?): @org.jspecify.nullness.Nullable Derived? + @org.jspecify.nullness.NullnessUnspecified public open fun everythingUnknown(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Derived!): @org.jspecify.nullness.NullnessUnspecified Derived! + @org.jspecify.nullness.Nullable public open fun foo(/*0*/ x: Derived, /*1*/ @org.jspecify.nullness.NullnessUnspecified y: @org.jspecify.nullness.NullnessUnspecified Base!): @org.jspecify.nullness.Nullable Derived? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt new file mode 100644 index 00000000000..f79a6a4f077 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt @@ -0,0 +1,31 @@ +// FIR_IDENTICAL +// !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) + // jspecify_nullness_mismatch + a1.bar(null) + a1.bar(x) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.bar(null) + // jspecify_nullness_mismatch + a2.bar(null) + a2.bar(x) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.txt new file mode 100644 index 00000000000..bd16bea0036 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.txt @@ -0,0 +1,20 @@ +package + +public fun main(/*0*/ a1: NonPlatformTypeParameter, /*1*/ a2: NonPlatformTypeParameter, /*2*/ x: T): kotlin.Unit + +public open class NonPlatformTypeParameter { + public constructor NonPlatformTypeParameter() + public open fun bar(/*0*/ e: E): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.fir.kt new file mode 100644 index 00000000000..991701746e9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.fir.kt @@ -0,0 +1,38 @@ +// 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 +// jspecify_nullness_mismatch +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter<Any?>, x: Test): Unit { + // jspecify_nullness_mismatch + a1.foo(null) + a1.foo(1) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.foo(1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar(null, null) + // jspecify_nullness_mismatch + a1.bar(x, null) + a1.bar(x, 1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar(null, null) + // jspecify_nullness_mismatch + a2.bar(x, null) + a2.bar(x, 1) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt new file mode 100644 index 00000000000..a015835f3be --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt @@ -0,0 +1,38 @@ +// 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 +// jspecify_nullness_mismatch +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter<Any?>, x: Test): Unit { + // jspecify_nullness_mismatch + a1.foo(null) + a1.foo(1) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.foo(1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar(null, null) + // jspecify_nullness_mismatch + a1.bar(x, null) + a1.bar(x, 1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar(null, null) + // jspecify_nullness_mismatch + a2.bar(x, null) + a2.bar(x, 1) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.txt new file mode 100644 index 00000000000..41475b86b4b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.txt @@ -0,0 +1,20 @@ +package + +public fun main(/*0*/ a1: NullnessUnspecifiedTypeParameter, /*1*/ a2: NullnessUnspecifiedTypeParameter, /*2*/ x: Test): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class NullnessUnspecifiedTypeParameter { + public constructor NullnessUnspecifiedTypeParameter() + public open fun bar(/*0*/ s: Test, /*1*/ t: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.fir.kt new file mode 100644 index 00000000000..7e4064b0d13 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.fir.kt @@ -0,0 +1,58 @@ +// 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) + // jspecify_nullness_mismatch + ak.foo(null) + + // jspecify_nullness_mismatch + akn.foo(null) + + bk.foo(bk) + // jspecify_nullness_mismatch + bk.foo(null) + + ck.foo(ck) + // jspecify_nullness_mismatch + ck.foo(null) + + // jspecify_nullness_mismatch + ckn.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt new file mode 100644 index 00000000000..98ac27083e7 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt @@ -0,0 +1,58 @@ +// 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) + // jspecify_nullness_mismatch + ak.foo(null) + + // jspecify_nullness_mismatch + akn.foo(null) + + bk.foo(bk) + // jspecify_nullness_mismatch + bk.foo(null) + + ck.foo(ck) + // jspecify_nullness_mismatch + ck.foo(null) + + // jspecify_nullness_mismatch + ckn.foo(null) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.txt new file mode 100644 index 00000000000..876a46667ac --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.txt @@ -0,0 +1,68 @@ +package + +public fun main(/*0*/ ak: AK, /*1*/ akn: AKN, /*2*/ bk: BK, /*3*/ ck: CK, /*4*/ ckn: CKN): kotlin.Unit + +public open class AK : SelfType { + public constructor AK() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: AK): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class AKN : SelfType<@org.jspecify.nullness.Nullable AK?> { + public constructor AKN() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable AK): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class B : SelfType { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: B): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class BK : B { + public constructor BK() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: B): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class C> : SelfType { + public constructor C>() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: E): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class CK : C { + public constructor CK() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: CK): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class CKN : C<@org.jspecify.nullness.Nullable CK?> { + public constructor CKN() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable CK): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class SelfType> { + public constructor SelfType>() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt new file mode 100644 index 00000000000..b51c622f6d4 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt @@ -0,0 +1,41 @@ +// FIR_IDENTICAL +// 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 { + // jspecify_nullness_mismatch + a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.foo(null, x).foo() + + a.bar().foo() + + // jspecify_nullness_mismatch + a.field.foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.txt new file mode 100644 index 00000000000..18d82bc6747 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.txt @@ -0,0 +1,29 @@ +package + +public fun main(/*0*/ a: Simple, /*1*/ x: Derived): kotlin.Unit + +public open class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Derived : Base { + public constructor Derived() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class Simple { + public constructor Simple() + @org.jspecify.nullness.Nullable public final var field: @org.jspecify.nullness.Nullable Derived? + public open fun bar(): Derived + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + @org.jspecify.nullness.Nullable public open fun foo(/*0*/ x: Derived, /*1*/ @org.jspecify.nullness.NullnessUnspecified y: @org.jspecify.nullness.NullnessUnspecified Base!): @org.jspecify.nullness.Nullable Derived? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.fir.kt new file mode 100644 index 00000000000..9a8a975a0fc --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.fir.kt @@ -0,0 +1,49 @@ +// 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) + // jspecify_nullness_mismatch + a.bar(aNotNullNotNullNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNotNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNull) + + b.bar(aNotNullNotNullNotNull) + b.bar(aNotNullNotNullNull) + b.bar(aNotNullNullNotNull) + b.bar(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt new file mode 100644 index 00000000000..6015fc5136d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt @@ -0,0 +1,49 @@ +// 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) + // jspecify_nullness_mismatch + a.bar(aNotNullNotNullNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNotNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNull) + + b.bar(aNotNullNotNullNotNull) + b.bar(aNotNullNotNullNull) + b.bar(aNotNullNullNotNull) + b.bar(aNotNullNullNull) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.txt new file mode 100644 index 00000000000..39147e078ca --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.txt @@ -0,0 +1,34 @@ +package + +public fun main(/*0*/ aNotNullNotNullNotNull: TypeArgumentsFromParameterBounds, /*1*/ aNotNullNotNullNull: TypeArgumentsFromParameterBounds, /*2*/ aNotNullNullNotNull: TypeArgumentsFromParameterBounds, /*3*/ aNotNullNullNull: TypeArgumentsFromParameterBounds, /*4*/ a: A, /*5*/ b: B): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class A { + public constructor A() + public open fun bar(/*0*/ a: TypeArgumentsFromParameterBounds): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class B { + public constructor B() + public open fun bar(/*0*/ a: TypeArgumentsFromParameterBounds!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class TypeArgumentsFromParameterBounds { + public constructor TypeArgumentsFromParameterBounds() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.fir.kt new file mode 100644 index 00000000000..543d753b4e9 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.fir.kt @@ -0,0 +1,47 @@ +// 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 +// jspecify_nullness_mismatch, jspecify_nullness_mismatch +fun main(a1: A<Any?>, a2: A, b1: B<Any?>, b2: B, x: T): Unit { + a1.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar<T?>(null) + a1.bar(x) + + a2.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar<T?>(null) + a2.bar(x) + + // jspecify_nullness_mismatch + b1.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + b1.bar<T?>(null) + b1.bar(x) + + // jspecify_nullness_mismatch + b2.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + b2.bar<T?>(null) + b2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt new file mode 100644 index 00000000000..0453bdfe237 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt @@ -0,0 +1,47 @@ +// 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 +// jspecify_nullness_mismatch, jspecify_nullness_mismatch +fun main(a1: A<Any?>, a2: A, b1: B<Any?>, b2: B, x: T): Unit { + a1.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar<T?>(null) + a1.bar(x) + + a2.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar<T?>(null) + a2.bar(x) + + // jspecify_nullness_mismatch + b1.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + b1.bar<T?>(null) + b1.bar(x) + + // jspecify_nullness_mismatch + b2.foo(null) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + b2.bar<T?>(null) + b2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.txt new file mode 100644 index 00000000000..d5655b46456 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.txt @@ -0,0 +1,29 @@ +package + +public fun main(/*0*/ a1: A, /*1*/ a2: A, /*2*/ b1: B, /*3*/ b2: B, /*4*/ x: T): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class A { + public constructor A() + public open fun bar(/*0*/ e: E): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ @org.jspecify.nullness.NullnessUnspecified t: @org.jspecify.nullness.NullnessUnspecified T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class B { + public constructor B() + public open fun bar(/*0*/ e: E): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.fir.kt new file mode 100644 index 00000000000..f78aaad678d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.fir.kt @@ -0,0 +1,18 @@ +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: J1.java +import org.jspecify.nullness.*; + +@NullMarked +public interface J1 { + T foo(); +} + +// FILE: J2.java +public interface J2 { + J1 bar(); +} + +// FILE: main.kt +fun baz(j2: J2): Any = j2.bar().foo() // Any..Any? diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt new file mode 100644 index 00000000000..53881e2a111 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt @@ -0,0 +1,18 @@ +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode + +// FILE: J1.java +import org.jspecify.nullness.*; + +@NullMarked +public interface J1 { + T foo(); +} + +// FILE: J2.java +public interface J2 { + J1 bar(); +} + +// FILE: main.kt +fun baz(j2: J2): Any = j2.bar().foo() // Any..Any? diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.txt new file mode 100644 index 00000000000..3b0f82a6d99 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.txt @@ -0,0 +1,17 @@ +package + +public fun baz(/*0*/ j2: J2): kotlin.Any + +@org.jspecify.nullness.NullMarked public interface J1 { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public abstract fun foo(): T + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface J2 { + public abstract fun bar(): J1! + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt new file mode 100644 index 00000000000..b49a858209c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt @@ -0,0 +1,36 @@ +// FIR_IDENTICAL +// 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/jspecifyOld/strictMode/WildcardsWithDefault.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.txt new file mode 100644 index 00000000000..63de62cdd61 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.txt @@ -0,0 +1,20 @@ +package + +public fun main(/*0*/ aNotNullNotNullNotNull: A, /*1*/ aNotNullNotNullNull: A, /*2*/ aNotNullNullNotNull: A, /*3*/ aNotNullNullNull: A, /*4*/ b: WildcardsWithDefault): kotlin.Unit + +public open class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class WildcardsWithDefault { + public constructor WildcardsWithDefault() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open fun noBoundsNotNull(/*0*/ a: A<*, *, *>): kotlin.Unit + public open fun noBoundsNullable(/*0*/ a: A): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt new file mode 100644 index 00000000000..e5734067dad --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt @@ -0,0 +1,23 @@ +// FIR_IDENTICAL +// JSPECIFY_STATE: strict +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +// MUTE_FOR_PSI_CLASS_FILES_READING + +// FILE: Foo.java +import org.jspecify.nullness.*; + +@NullMarked +public interface Foo { + void test(Bar list); +} + +// FILE: Bar.java +import org.jspecify.nullness.*; + +@NullMarked +public interface Bar {} + +// FILE: main.kt +fun test(foo: Foo, bar: Bar) { + foo.test(")!>bar) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.txt new file mode 100644 index 00000000000..70bcc842f87 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.txt @@ -0,0 +1,16 @@ +package + +public fun test(/*0*/ foo: Foo, /*1*/ bar: Bar): kotlin.Unit + +@org.jspecify.nullness.NullMarked public interface Bar { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public interface Foo { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract fun test(/*0*/ list: Bar<*>): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.fir.kt new file mode 100644 index 00000000000..8629d6caf57 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.fir.kt @@ -0,0 +1,137 @@ +// 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(), + // jspecify_nullness_mismatch + UtilNullMarked.getFooOfString() + ) +} + +fun test3() { + // String in Foo is not null + isNotNullAndNullableStringInFoo( + UtilNullMarkedGeneric.getFooOfK(), + // jspecify_nullness_mismatch + 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/jspecifyOld/strictMode/kt47422.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt new file mode 100644 index 00000000000..ff0f52fa648 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt @@ -0,0 +1,137 @@ +// 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(), + // jspecify_nullness_mismatch + UtilNullMarked.getFooOfString() + ) +} + +fun test3() { + // String in Foo is not null + isNotNullAndNullableStringInFoo( + UtilNullMarkedGeneric.getFooOfK(), + // jspecify_nullness_mismatch + 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/jspecifyOld/strictMode/kt47422.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.txt new file mode 100644 index 00000000000..38dfd8a110e --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.txt @@ -0,0 +1,87 @@ +package + +public fun isNotNullAndNullableStringInFoo(/*0*/ x: Foo, /*1*/ y: Foo): kotlin.Unit +public fun test1(): kotlin.Unit +public fun test2(): kotlin.Unit +public fun test3(): kotlin.Unit +public fun test4(): kotlin.Unit +public fun test5(): kotlin.Unit +public fun test6(): kotlin.Unit +public fun test7(): kotlin.Unit + +public interface Foo { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Util { + public constructor Util() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfString(): Foo! +} + +public open class UtilGenericNullableBound { + public constructor UtilGenericNullableBound() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfK(): Foo! +} + +public open class UtilGenericNullnessUnspecifiedBound { + public constructor UtilGenericNullnessUnspecifiedBound() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfK(): Foo! +} + +@org.jspecify.nullness.NullMarked public open class UtilNullMarked { + public constructor UtilNullMarked() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfString(): Foo +} + +@org.jspecify.nullness.NullMarked public open class UtilNullMarkedGeneric { + public constructor UtilNullMarkedGeneric() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfK(): Foo +} + +@org.jspecify.nullness.NullMarked public open class UtilNullMarkedGenericNullableBound { + public constructor UtilNullMarkedGenericNullableBound() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfK(): Foo +} + +@org.jspecify.nullness.NullMarked public open class UtilNullMarkedGenericNullnessUnspecifiedBound { + public constructor UtilNullMarkedGenericNullnessUnspecifiedBound() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun getFooOfK(): Foo +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt new file mode 100644 index 00000000000..cea3e05bba3 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt @@ -0,0 +1,19 @@ +// FIR_IDENTICAL +// 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/jspecifyOld/strictMode/kt47437.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.txt new file mode 100644 index 00000000000..da6e80b8960 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.txt @@ -0,0 +1,14 @@ +package + +public fun test(): Foo + +@org.jspecify.nullness.NullMarked public open class Foo { + public constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public/*package*/ open fun ..kotlin.Comparable?)> create(): Foo +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt new file mode 100644 index 00000000000..078af3fac89 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt @@ -0,0 +1,35 @@ +// FIR_IDENTICAL +// JSR305_GLOBAL_REPORT: strict +// JSPECIFY_STATE: strict +// WITH_STDLIB +// FULL_JDK + +// FILE: MyCollection.java +import java.util.AbstractCollection; +import javax.annotation.CheckForNull; +import org.jspecify.nullness.NullMarked; + +@NullMarked +public abstract class MyCollection extends AbstractCollection { + @Override + public boolean contains(@CheckForNull Object o) { + return false; + } +} + +// FILE: MyList.java +import java.util.AbstractCollection; +import java.util.List; +import javax.annotation.CheckForNull; +import org.jspecify.nullness.NullMarked; + +@NullMarked +public abstract class MyList extends MyCollection implements List { + @Override + public boolean contains(@CheckForNull Object o) { + return false; + } +} + +// FILE: main.kt +fun go(myList : MyList, string : String) = string in myList diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.txt new file mode 100644 index 00000000000..21d01549f39 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.txt @@ -0,0 +1,75 @@ +package + +public fun go(/*0*/ myList: MyList, /*1*/ string: kotlin.String): kotlin.Boolean + +@org.jspecify.nullness.NullMarked public abstract class MyCollection : java.util.AbstractCollection { + public constructor MyCollection() + public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int + public open override /*1*/ /*fake_override*/ fun add(/*0*/ element: E!): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit + @java.lang.Override public open override /*1*/ fun contains(/*0*/ @javax.annotation.CheckForNull element: E!): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.Consumer!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator + public open override /*1*/ /*fake_override*/ fun parallelStream(): java.util.stream.Stream + public open override /*1*/ /*fake_override*/ fun remove(/*0*/ element: E!): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun removeIf(/*0*/ p0: java.util.function.Predicate): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun spliterator(): java.util.Spliterator + public open override /*1*/ /*fake_override*/ fun stream(): java.util.stream.Stream + public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>! + public open override /*1*/ /*fake_override*/ fun toArray(/*0*/ p0: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>! + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + invisible_fake const final override /*1*/ /*fake_override*/ val MAX_ARRAY_SIZE: kotlin.Int = 2147483639 + invisible_fake open override /*1*/ /*fake_override*/ fun finishToArray(/*0*/ p0: kotlin.Array<(out) T!>!, /*1*/ p1: kotlin.collections.(Mutable)Iterator<*>!): kotlin.Array<(out) T!>! + invisible_fake open override /*1*/ /*fake_override*/ fun hugeCapacity(/*0*/ p0: kotlin.Int): kotlin.Int +} + +@org.jspecify.nullness.NullMarked public abstract class MyList : MyCollection, kotlin.collections.MutableList { + public constructor MyList() + public abstract override /*2*/ /*fake_override*/ val size: kotlin.Int + public open override /*2*/ /*fake_override*/ fun add(/*0*/ element: E): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: E): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun clear(): kotlin.Unit + @java.lang.Override public open override /*2*/ fun contains(/*0*/ @javax.annotation.CheckForNull element: E!): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.Consumer): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): E + public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: E): kotlin.Int + public open override /*2*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean + public abstract override /*2*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator + public abstract override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: E): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator + public abstract override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator + public open override /*2*/ /*fake_override*/ fun parallelStream(): java.util.stream.Stream + public open override /*2*/ /*fake_override*/ fun remove(/*0*/ element: E!): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun removeAt(/*0*/ index: kotlin.Int): E + public open override /*2*/ /*fake_override*/ fun removeIf(/*0*/ p0: java.util.function.Predicate): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.UnaryOperator): kotlin.Unit + public open override /*2*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: E): E + public open override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun sort(/*0*/ p0: java.util.Comparator!): kotlin.Unit + public open override /*2*/ /*fake_override*/ fun spliterator(): java.util.Spliterator + public open override /*2*/ /*fake_override*/ fun stream(): java.util.stream.Stream + public abstract override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList + public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>! + public open override /*1*/ /*fake_override*/ fun toArray(/*0*/ p0: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>! + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + invisible_fake const final override /*1*/ /*fake_override*/ val MAX_ARRAY_SIZE: kotlin.Int = 2147483639 + invisible_fake open override /*1*/ /*fake_override*/ fun finishToArray(/*0*/ p0: kotlin.Array<(out) T!>!, /*1*/ p1: kotlin.collections.(Mutable)Iterator<*>!): kotlin.Array<(out) T!>! + invisible_fake open override /*1*/ /*fake_override*/ fun hugeCapacity(/*0*/ p0: kotlin.Int): kotlin.Int +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.fir.kt new file mode 100644 index 00000000000..6cccaeaaa27 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.fir.kt @@ -0,0 +1,89 @@ +// 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 { + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNull) + b.superAsIs(aAnyNotNullNullNotNull) + b.superAsIs(aAnyNotNullNullNull) + + b.superNotNull(aAnyNotNullNotNullNotNull) + b.superNotNull(aAnyNotNullNotNullNull) + b.superNotNull(aAnyNotNullNullNotNull) + b.superNotNull(aAnyNotNullNullNull) + + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNull) + + b.extendsAsIs(aNotNullNotNullNotNull) + b.extendsAsIs(aNotNullNotNullNull) + b.extendsAsIs(aNotNullNullNotNull) + b.extendsAsIs(aNotNullNullNull) + + b.extendsNotNull(aNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNotNullNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNullNotNull) + // jspecify_nullness_mismatch + 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/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt new file mode 100644 index 00000000000..7c214c08363 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt @@ -0,0 +1,89 @@ +// 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 { + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superAsIs(aAnyNotNullNotNullNull) + b.superAsIs(aAnyNotNullNullNotNull) + b.superAsIs(aAnyNotNullNullNull) + + b.superNotNull(aAnyNotNullNotNullNotNull) + b.superNotNull(aAnyNotNullNotNullNull) + b.superNotNull(aAnyNotNullNullNotNull) + b.superNotNull(aAnyNotNullNullNull) + + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNotNullNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNotNull) + // jspecify_nullness_mismatch + b.superNullable(aAnyNotNullNullNull) + + b.extendsAsIs(aNotNullNotNullNotNull) + b.extendsAsIs(aNotNullNotNullNull) + b.extendsAsIs(aNotNullNullNotNull) + b.extendsAsIs(aNotNullNullNull) + + b.extendsNotNull(aNotNullNotNullNotNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNotNullNull) + // jspecify_nullness_mismatch + b.extendsNotNull(aNotNullNullNotNull) + // jspecify_nullness_mismatch + 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) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.txt new file mode 100644 index 00000000000..944ebff7fbd --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.txt @@ -0,0 +1,39 @@ +package + +public fun main(/*0*/ aNotNullNotNullNotNull: Test, /*1*/ aNotNullNotNullNull: Test, /*2*/ aNotNullNullNotNull: Test, /*3*/ aNotNullNullNull: Test, /*4*/ aAnyNotNullNotNullNotNull: Test, /*5*/ aAnyNotNullNotNullNull: Test, /*6*/ aAnyNotNullNullNotNull: Test, /*7*/ aAnyNotNullNullNull: Test, /*8*/ b: AnnotatedBoundsOfWildcard): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class AnnotatedBoundsOfWildcard { + public constructor AnnotatedBoundsOfWildcard() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun extendsAsIs(/*0*/ a: Test!): kotlin.Unit + public open fun extendsNotNull(/*0*/ a: Test!): kotlin.Unit + public open fun extendsNullable(/*0*/ a: Test!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open fun noBounds(/*0*/ a: Test!): kotlin.Unit + public open fun superAsIs(/*0*/ a: Test!): kotlin.Unit + public open fun superNotNull(/*0*/ a: Test!): kotlin.Unit + public open fun superNullable(/*0*/ a: Test!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Derived : Base { + public constructor Derived() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt new file mode 100644 index 00000000000..7261ab9c634 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt @@ -0,0 +1,18 @@ +// FIR_IDENTICAL +// JSPECIFY_STATE: warn +// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode +// FILE: J1.java +import org.jetbrains.annotations.Nullable; + +public interface J1 { + @Nullable + public static T foo(J1 x) { return null; } +} + +// FILE: J2.java +import org.jspecify.nullness.Nullable; + +public interface J2 extends J1 { } + +// FILE: kotlin.kt +private fun J2<*>.bar() = J1.foo(this) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.txt new file mode 100644 index 00000000000..2b3976fc916 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.txt @@ -0,0 +1,18 @@ +package + +private fun J2<*>.bar(): @org.jspecify.nullness.Nullable kotlin.Any? + +public interface J1 { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + @org.jetbrains.annotations.Nullable public open fun foo(/*0*/ x: J1!): @org.jetbrains.annotations.Nullable T? +} + +public interface J2 : J1 { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.fir.kt new file mode 100644 index 00000000000..048ce9e372a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.fir.kt @@ -0,0 +1,50 @@ +// 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 { + // jspecify_nullness_mismatch + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + // jspecify_nullness_mismatch + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.mixed(null).foo() + // jspecify_nullness_mismatch + a.mixed(x).foo() + + a.explicitlyNullnessUnspecified(x).foo() + a.explicitlyNullnessUnspecified(null).foo() + + a.defaultField.foo() + + // jspecify_nullness_mismatch + a.field.foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt new file mode 100644 index 00000000000..e58ffb39fed --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt @@ -0,0 +1,50 @@ +// 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 { + // jspecify_nullness_mismatch + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + // jspecify_nullness_mismatch + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.mixed(null).foo() + // jspecify_nullness_mismatch + a.mixed(x).foo() + + a.explicitlyNullnessUnspecified(x).foo() + a.explicitlyNullnessUnspecified(null).foo() + + a.defaultField.foo() + + // jspecify_nullness_mismatch + a.field.foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.txt new file mode 100644 index 00000000000..110f4bed969 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.txt @@ -0,0 +1,26 @@ +package + +public fun main(/*0*/ a: Defaults, /*1*/ x: Foo): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class Defaults { + public constructor Defaults() + public final var defaultField: Foo! + @org.jspecify.nullness.Nullable public final var field: @org.jspecify.nullness.Nullable Foo! + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun everythingNotNullable(/*0*/ x: Foo!): Foo! + @org.jspecify.nullness.Nullable public open fun everythingNullable(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable Foo!): @org.jspecify.nullness.Nullable Foo! + @org.jspecify.nullness.NullnessUnspecified public open fun everythingUnknown(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): @org.jspecify.nullness.NullnessUnspecified Foo! + public open fun explicitlyNullnessUnspecified(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): Foo! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + @org.jspecify.nullness.Nullable public open fun mixed(/*0*/ x: Foo!): @org.jspecify.nullness.Nullable Foo! + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Foo { + public constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(): kotlin.Any! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.fir.kt new file mode 100644 index 00000000000..a6a9dc22713 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.fir.kt @@ -0,0 +1,48 @@ +// 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 { + // jspecify_nullness_mismatch + a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.foo(null, x).foo() + + // jspecify_nullness_mismatch + a.field.foo() + + // jspecify_nullness_mismatch + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + // jspecify_nullness_mismatch + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt new file mode 100644 index 00000000000..1b4442ffe0b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt @@ -0,0 +1,48 @@ +// 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 { + // jspecify_nullness_mismatch + a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.foo(null, x).foo() + + // jspecify_nullness_mismatch + a.field.foo() + + // jspecify_nullness_mismatch + a.everythingNotNullable(null).foo() + a.everythingNotNullable(x).foo() + + // jspecify_nullness_mismatch + a.everythingNullable(null).foo() + + a.everythingUnknown(null).foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.txt new file mode 100644 index 00000000000..61cbeca0771 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.txt @@ -0,0 +1,32 @@ +package + +public fun main(/*0*/ a: IgnoreAnnotations, /*1*/ x: Derived): kotlin.Unit + +public open class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Derived : Base { + public constructor Derived() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class IgnoreAnnotations { + public constructor IgnoreAnnotations() + @org.jspecify.nullness.Nullable public final var field: @org.jspecify.nullness.Nullable Derived! + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun everythingNotNullable(/*0*/ x: Derived!): Derived! + @org.jspecify.nullness.Nullable public open fun everythingNullable(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable Derived!): @org.jspecify.nullness.Nullable Derived! + @org.jspecify.nullness.NullnessUnspecified public open fun everythingUnknown(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Derived!): @org.jspecify.nullness.NullnessUnspecified Derived! + @org.jspecify.nullness.Nullable public open fun foo(/*0*/ x: Derived!, /*1*/ @org.jspecify.nullness.NullnessUnspecified y: @org.jspecify.nullness.NullnessUnspecified Base!): @org.jspecify.nullness.Nullable Derived! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.fir.kt new file mode 100644 index 00000000000..29b208b6547 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.fir.kt @@ -0,0 +1,30 @@ +// 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) + // jspecify_nullness_mismatch + a1.bar(null) + a1.bar(x) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.bar(null) + // jspecify_nullness_mismatch + a2.bar(null) + a2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt new file mode 100644 index 00000000000..ebb2ef5ec16 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt @@ -0,0 +1,30 @@ +// 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) + // jspecify_nullness_mismatch + a1.bar(null) + a1.bar(x) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.bar(null) + // jspecify_nullness_mismatch + a2.bar(null) + a2.bar(x) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.txt new file mode 100644 index 00000000000..11a79d536a8 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.txt @@ -0,0 +1,20 @@ +package + +public fun main(/*0*/ a1: NonPlatformTypeParameter, /*1*/ a2: NonPlatformTypeParameter, /*2*/ x: T): kotlin.Unit + +public open class NonPlatformTypeParameter { + public constructor NonPlatformTypeParameter() + public open fun bar(/*0*/ e: E!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.fir.kt new file mode 100644 index 00000000000..503a57efe22 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.fir.kt @@ -0,0 +1,37 @@ +// 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 +// jspecify_nullness_mismatch +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter, x: Test): Unit { + // jspecify_nullness_mismatch + a1.foo(null) + a1.foo(1) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.foo(1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar(null, null) + // jspecify_nullness_mismatch + a1.bar(x, null) + a1.bar(x, 1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar(null, null) + // jspecify_nullness_mismatch + a2.bar(x, null) + a2.bar(x, 1) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt new file mode 100644 index 00000000000..a3154623f08 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt @@ -0,0 +1,37 @@ +// 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 +// jspecify_nullness_mismatch +fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter<Any?>, x: Test): Unit { + // jspecify_nullness_mismatch + a1.foo(null) + a1.foo(1) + + // jspecify_nullness_mismatch + a2.foo(null) + a2.foo(1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a1.bar(null, null) + // jspecify_nullness_mismatch + a1.bar(x, null) + a1.bar(x, 1) + + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a2.bar(null, null) + // jspecify_nullness_mismatch + a2.bar(x, null) + a2.bar(x, 1) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.txt new file mode 100644 index 00000000000..7c801cda016 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.txt @@ -0,0 +1,20 @@ +package + +public fun main(/*0*/ a1: NullnessUnspecifiedTypeParameter, /*1*/ a2: NullnessUnspecifiedTypeParameter, /*2*/ x: Test): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class NullnessUnspecifiedTypeParameter { + public constructor NullnessUnspecifiedTypeParameter() + public open fun bar(/*0*/ s: Test!, /*1*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.fir.kt new file mode 100644 index 00000000000..47c613ef709 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.fir.kt @@ -0,0 +1,79 @@ +// JSPECIFY_STATE: warn + +// FILE: Foo.java +public interface Foo {} +// FILE: BaseClass.java + +import org.jspecify.nullness.*; + +@NullMarked +public class BaseClass { + 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: main.kt + +private val FOO = object : Foo {} + +class Correct : BaseClass() { + override fun everythingNotNullable(x: Foo): Foo { + return FOO + } + + override fun everythingNullable(x: Foo?): Foo? { + return null + } + + override fun everythingUnknown(x: Foo?): Foo? { + return null + } + + override fun mixed(x: Foo): Foo? { + return null + } + + override fun explicitlyNullnessUnspecified(x: Foo): Foo { + return FOO + } +} + +class WrongReturnTypes : BaseClass() { + override fun everythingNotNullable(x: Foo): Foo? { + return null + } + + override fun explicitlyNullnessUnspecified(x: Foo): Foo? { + return null + } +} + +class WrongParameter : BaseClass() { + override fun everythingNotNullable(x: Foo?): Foo { + return FOO + } + + override fun everythingNullable(x: Foo): Foo? { + return null + } + + override fun everythingUnknown(x: Foo): Foo? { + return null + } + + override fun mixed(x: Foo?): Foo? { + return null + } + + override fun explicitlyNullnessUnspecified(x: Foo?): Foo { + return FOO + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt new file mode 100644 index 00000000000..7579f0cedaf --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt @@ -0,0 +1,79 @@ +// JSPECIFY_STATE: warn + +// FILE: Foo.java +public interface Foo {} +// FILE: BaseClass.java + +import org.jspecify.nullness.*; + +@NullMarked +public class BaseClass { + 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: main.kt + +private val FOO = object : Foo {} + +class Correct : BaseClass() { + override fun everythingNotNullable(x: Foo): Foo { + return FOO + } + + override fun everythingNullable(x: Foo?): Foo? { + return null + } + + override fun everythingUnknown(x: Foo?): Foo? { + return null + } + + override fun mixed(x: Foo): Foo? { + return null + } + + override fun explicitlyNullnessUnspecified(x: Foo): Foo { + return FOO + } +} + +class WrongReturnTypes : BaseClass() { + override fun everythingNotNullable(x: Foo): Foo? { + return null + } + + override fun explicitlyNullnessUnspecified(x: Foo): Foo? { + return null + } +} + +class WrongParameter : BaseClass() { + override fun everythingNotNullable(x: Foo?): Foo { + return FOO + } + + override fun everythingNullable(x: Foo): Foo? { + return null + } + + override fun everythingUnknown(x: Foo): Foo? { + return null + } + + override fun mixed(x: Foo?): Foo? { + return null + } + + override fun explicitlyNullnessUnspecified(x: Foo?): Foo { + return FOO + } +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.txt new file mode 100644 index 00000000000..d720cc9f30c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.txt @@ -0,0 +1,57 @@ +package + +private val FOO: FOO.`` + +@org.jspecify.nullness.NullMarked public open class BaseClass { + public constructor BaseClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun everythingNotNullable(/*0*/ x: Foo!): Foo! + @org.jspecify.nullness.Nullable public open fun everythingNullable(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable Foo!): @org.jspecify.nullness.Nullable Foo! + @org.jspecify.nullness.NullnessUnspecified public open fun everythingUnknown(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): @org.jspecify.nullness.NullnessUnspecified Foo! + public open fun explicitlyNullnessUnspecified(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): Foo! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + @org.jspecify.nullness.Nullable public open fun mixed(/*0*/ x: Foo!): @org.jspecify.nullness.Nullable Foo! + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Correct : BaseClass { + public constructor Correct() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ fun everythingNotNullable(/*0*/ x: Foo): Foo + public open override /*1*/ fun everythingNullable(/*0*/ x: Foo?): Foo? + public open override /*1*/ fun everythingUnknown(/*0*/ x: Foo?): Foo? + public open override /*1*/ fun explicitlyNullnessUnspecified(/*0*/ x: Foo): Foo + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun mixed(/*0*/ x: Foo): Foo? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface Foo { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class WrongParameter : BaseClass { + public constructor WrongParameter() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ fun everythingNotNullable(/*0*/ x: Foo?): Foo + public open override /*1*/ fun everythingNullable(/*0*/ x: Foo): Foo? + public open override /*1*/ fun everythingUnknown(/*0*/ x: Foo): Foo? + public open override /*1*/ fun explicitlyNullnessUnspecified(/*0*/ x: Foo?): Foo + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun mixed(/*0*/ x: Foo?): Foo? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class WrongReturnTypes : BaseClass { + public constructor WrongReturnTypes() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ fun everythingNotNullable(/*0*/ x: Foo): Foo? + @org.jspecify.nullness.Nullable public open override /*1*/ /*fake_override*/ fun everythingNullable(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable Foo!): @org.jspecify.nullness.Nullable Foo! + @org.jspecify.nullness.NullnessUnspecified public open override /*1*/ /*fake_override*/ fun everythingUnknown(/*0*/ @org.jspecify.nullness.NullnessUnspecified x: @org.jspecify.nullness.NullnessUnspecified Foo!): @org.jspecify.nullness.NullnessUnspecified Foo! + public open override /*1*/ fun explicitlyNullnessUnspecified(/*0*/ x: Foo): Foo? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + @org.jspecify.nullness.Nullable public open override /*1*/ /*fake_override*/ fun mixed(/*0*/ x: Foo!): @org.jspecify.nullness.Nullable Foo! + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.fir.kt new file mode 100644 index 00000000000..a24dae1365e --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.fir.kt @@ -0,0 +1,57 @@ +// 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) + // jspecify_nullness_mismatch + ak.foo(null) + + akn.foo(null) // the corresponding warning/error is present on the Java side + + bk.foo(bk) + // jspecify_nullness_mismatch + bk.foo(null) + + ck.foo(ck) + // jspecify_nullness_mismatch + ck.foo(null) + + ckn.foo(null) // the corresponding warning/error is present on the Java side +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt new file mode 100644 index 00000000000..ce78cab1543 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt @@ -0,0 +1,57 @@ +// 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) + // jspecify_nullness_mismatch + ak.foo(null) + + akn.foo(null) // the corresponding warning/error is present on the Java side + + bk.foo(bk) + // jspecify_nullness_mismatch + bk.foo(null) + + ck.foo(ck) + // jspecify_nullness_mismatch + ck.foo(null) + + ckn.foo(null) // the corresponding warning/error is present on the Java side +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.txt new file mode 100644 index 00000000000..be8558b2e1f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.txt @@ -0,0 +1,68 @@ +package + +public fun main(/*0*/ ak: AK, /*1*/ akn: AKN, /*2*/ bk: BK, /*3*/ ck: CK, /*4*/ ckn: CKN): kotlin.Unit + +public open class AK : SelfType { + public constructor AK() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: AK!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class AKN : SelfType<@org.jspecify.nullness.Nullable AK!> { + public constructor AKN() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable AK!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class B : SelfType { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: B!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class BK : B { + public constructor BK() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: B!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class C!> : SelfType { + public constructor C!>() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: E!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class CK : C { + public constructor CK() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: CK!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class CKN : C<@org.jspecify.nullness.Nullable CK!> { + public constructor CKN() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable CK!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class SelfType!> { + public constructor SelfType!>() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.fir.kt new file mode 100644 index 00000000000..c1b530787af --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.fir.kt @@ -0,0 +1,39 @@ +// 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 { + // jspecify_nullness_mismatch + a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.foo(null, x).foo() + + a.bar().foo() + + // jspecify_nullness_mismatch + a.field.foo() +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt new file mode 100644 index 00000000000..5a73770c3d6 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt @@ -0,0 +1,39 @@ +// 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 { + // jspecify_nullness_mismatch + a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch + a.foo(null, x).foo() + + a.bar().foo() + + // jspecify_nullness_mismatch + a.field.foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.txt new file mode 100644 index 00000000000..41c457dfdb8 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.txt @@ -0,0 +1,29 @@ +package + +public fun main(/*0*/ a: Simple, /*1*/ x: Derived): kotlin.Unit + +public open class Base { + public constructor Base() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Derived : Base { + public constructor Derived() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class Simple { + public constructor Simple() + @org.jspecify.nullness.Nullable public final var field: @org.jspecify.nullness.Nullable Derived! + public open fun bar(): Derived! + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + @org.jspecify.nullness.Nullable public open fun foo(/*0*/ x: Derived!, /*1*/ @org.jspecify.nullness.NullnessUnspecified y: @org.jspecify.nullness.NullnessUnspecified Base!): @org.jspecify.nullness.Nullable Derived! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.fir.kt new file mode 100644 index 00000000000..a91a719fc55 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.fir.kt @@ -0,0 +1,48 @@ +// 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) + // jspecify_nullness_mismatch + a.bar(aNotNullNotNullNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNotNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNull) + + b.bar(aNotNullNotNullNotNull) + b.bar(aNotNullNotNullNull) + b.bar(aNotNullNullNotNull) + b.bar(aNotNullNullNull) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt new file mode 100644 index 00000000000..662f411c049 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt @@ -0,0 +1,48 @@ +// 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) + // jspecify_nullness_mismatch + a.bar(aNotNullNotNullNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNotNull) + // jspecify_nullness_mismatch + a.bar(aNotNullNullNull) + + b.bar(aNotNullNotNullNotNull) + b.bar(aNotNullNotNullNull) + b.bar(aNotNullNullNotNull) + b.bar(aNotNullNullNull) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.txt new file mode 100644 index 00000000000..4478b67eabf --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.txt @@ -0,0 +1,34 @@ +package + +public fun main(/*0*/ aNotNullNotNullNotNull: TypeArgumentsFromParameterBounds, /*1*/ aNotNullNotNullNull: TypeArgumentsFromParameterBounds, /*2*/ aNotNullNullNotNull: TypeArgumentsFromParameterBounds, /*3*/ aNotNullNullNull: TypeArgumentsFromParameterBounds, /*4*/ a: A, /*5*/ b: B): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class A { + public constructor A() + public open fun bar(/*0*/ a: TypeArgumentsFromParameterBounds!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class B { + public constructor B() + public open fun bar(/*0*/ a: TypeArgumentsFromParameterBounds!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class TypeArgumentsFromParameterBounds { + public constructor TypeArgumentsFromParameterBounds() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.fir.kt new file mode 100644 index 00000000000..ba8e8581c16 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.fir.kt @@ -0,0 +1,46 @@ +// 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 +// jspecify_nullness_mismatch, jspecify_nullness_mismatch +fun main(a1: A, a2: A, b1: B, b2: B, x: T): Unit { + a1.foo(null) + // jspecify_nullness_mismatch + a1.bar(null) + a1.bar(x) + + a2.foo(null) + // jspecify_nullness_mismatch + a2.bar(null) + a2.bar(x) + + // jspecify_nullness_mismatch + b1.foo(null) + // jspecify_nullness_mismatch + b1.bar(null) + b1.bar(x) + + // jspecify_nullness_mismatch + b2.foo(null) + // jspecify_nullness_mismatch + b2.bar(null) + b2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt new file mode 100644 index 00000000000..c2aa20fbe18 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt @@ -0,0 +1,46 @@ +// 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 +// jspecify_nullness_mismatch, jspecify_nullness_mismatch +fun main(a1: A<Any?>, a2: A, b1: B<Any?>, b2: B, x: T): Unit { + a1.foo(null) + // jspecify_nullness_mismatch + a1.bar<T?>(null) + a1.bar(x) + + a2.foo(null) + // jspecify_nullness_mismatch + a2.bar<T?>(null) + a2.bar(x) + + // jspecify_nullness_mismatch + b1.foo(null) + // jspecify_nullness_mismatch + b1.bar<T?>(null) + b1.bar(x) + + // jspecify_nullness_mismatch + b2.foo(null) + // jspecify_nullness_mismatch + b2.bar<T?>(null) + b2.bar(x) +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.txt new file mode 100644 index 00000000000..76b1239b0a8 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.txt @@ -0,0 +1,29 @@ +package + +public fun main(/*0*/ a1: A, /*1*/ a2: A, /*2*/ b1: B, /*3*/ b2: B, /*4*/ x: T): kotlin.Unit + +@org.jspecify.nullness.NullMarked public open class A { + public constructor A() + public open fun bar(/*0*/ e: E!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ @org.jspecify.nullness.NullnessUnspecified t: @org.jspecify.nullness.NullnessUnspecified T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class B { + public constructor B() + public open fun bar(/*0*/ e: E!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ t: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt new file mode 100644 index 00000000000..6344ec52ed3 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt @@ -0,0 +1,17 @@ +// FIR_IDENTICAL +// JSPECIFY_STATE: warn +// FILE: J1.java +import org.jspecify.nullness.*; + +@NullMarked +public interface J1 { + T foo(); +} + +// FILE: J2.java +public interface J2 { + J1 bar(); +} + +// FILE: main.kt +fun baz(j2: J2): Any = j2.bar().foo() // Any..Any? diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.txt new file mode 100644 index 00000000000..c29daea928d --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.txt @@ -0,0 +1,17 @@ +package + +public fun baz(/*0*/ j2: J2): kotlin.Any + +@org.jspecify.nullness.NullMarked public interface J1 { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public abstract fun foo(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface J2 { + public abstract fun bar(): J1! + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt new file mode 100644 index 00000000000..689eccab52b --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt @@ -0,0 +1,36 @@ +// FIR_IDENTICAL +// 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/jspecifyOld/warnMode/WildcardsWithDefault.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.txt new file mode 100644 index 00000000000..5bbeb3a608a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.txt @@ -0,0 +1,20 @@ +package + +public fun main(/*0*/ aNotNullNotNullNotNull: A, /*1*/ aNotNullNotNullNull: A, /*2*/ aNotNullNullNotNull: A, /*3*/ aNotNullNullNull: A, /*4*/ b: WildcardsWithDefault): kotlin.Unit + +public open class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@org.jspecify.nullness.NullMarked public open class WildcardsWithDefault { + public constructor WildcardsWithDefault() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open fun noBoundsNotNull(/*0*/ a: A<*, *, *>!): kotlin.Unit + public open fun noBoundsNullable(/*0*/ a: A!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.fir.kt new file mode 100644 index 00000000000..bb4032ca517 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/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/jspecifyOld/warnMode/kt47899.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt new file mode 100644 index 00000000000..5241faec862 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.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/jspecifyOld/warnMode/kt47899.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.txt new file mode 100644 index 00000000000..ccd1bd4286f --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.txt @@ -0,0 +1,13 @@ +package + +public fun test(/*0*/ metric: T): kotlin.Unit + +public open class Foo { + public constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun gauge(/*0*/ @org.jspecify.nullness.Nullable stateObject: @org.jspecify.nullness.Nullable T!): kotlin.Unit +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaTestGenerated.java index beefbdc02e5..26a37348bfb 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaTestGenerated.java @@ -840,6 +840,222 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign } } + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("kt48261.kt") + public void testKt48261() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("OverrideOfAnnotated.kt") + public void testOverrideOfAnnotated() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") @TestDataPath("$PROJECT_ROOT") @@ -1197,5 +1413,177 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign } } } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } } } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java index be452bc8427..8e24859eba4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java @@ -840,6 +840,222 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte } } + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("kt48261.kt") + public void testKt48261() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("OverrideOfAnnotated.kt") + public void testOverrideOfAnnotated() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") @TestDataPath("$PROJECT_ROOT") @@ -1197,5 +1413,177 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte } } } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } } } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsSourceJavaTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsSourceJavaTestGenerated.java index 5d845a6b2a8..520c830a9b4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsSourceJavaTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ForeignAnnotationsSourceJavaTestGenerated.java @@ -840,6 +840,222 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn } } + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("default.kt") + public void testDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/default.kt"); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode") + @TestDataPath("$PROJECT_ROOT") + public class StrictMode { + @Test + public void testAllFilesPresentInStrictMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47396.kt") + public void testKt47396() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47396.kt"); + } + + @Test + @TestMetadata("kt47422.kt") + public void testKt47422() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47422.kt"); + } + + @Test + @TestMetadata("kt47437.kt") + public void testKt47437() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt47437.kt"); + } + + @Test + @TestMetadata("kt48261.kt") + public void testKt48261() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/kt48261.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/strictMode/WildcardsWithDefault.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode") + @TestDataPath("$PROJECT_ROOT") + public class WarnMode { + @Test + public void testAllFilesPresentInWarnMode() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("AnnotatedBoundsOfWildcard.kt") + public void testAnnotatedBoundsOfWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/AnnotatedBoundsOfWildcard.kt"); + } + + @Test + @TestMetadata("Captured.kt") + public void testCaptured() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Captured.kt"); + } + + @Test + @TestMetadata("Defaults.kt") + public void testDefaults() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Defaults.kt"); + } + + @Test + @TestMetadata("IgnoreAnnotations.kt") + public void testIgnoreAnnotations() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/IgnoreAnnotations.kt"); + } + + @Test + @TestMetadata("kt47899.kt") + public void testKt47899() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/kt47899.kt"); + } + + @Test + @TestMetadata("NonPlatformTypeParameter.kt") + public void testNonPlatformTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NonPlatformTypeParameter.kt"); + } + + @Test + @TestMetadata("NullnessUnspecifiedTypeParameter.kt") + public void testNullnessUnspecifiedTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/NullnessUnspecifiedTypeParameter.kt"); + } + + @Test + @TestMetadata("OverrideOfAnnotated.kt") + public void testOverrideOfAnnotated() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/OverrideOfAnnotated.kt"); + } + + @Test + @TestMetadata("SelfType.kt") + public void testSelfType() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/SelfType.kt"); + } + + @Test + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/Simple.kt"); + } + + @Test + @TestMetadata("TypeArgumentsFromParameterBounds.kt") + public void testTypeArgumentsFromParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeArgumentsFromParameterBounds.kt"); + } + + @Test + @TestMetadata("TypeParameterBounds.kt") + public void testTypeParameterBounds() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/TypeParameterBounds.kt"); + } + + @Test + @TestMetadata("UnannotatedWildcard.kt") + public void testUnannotatedWildcard() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/UnannotatedWildcard.kt"); + } + + @Test + @TestMetadata("WildcardsWithDefault.kt") + public void testWildcardsWithDefault() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecifyOld/warnMode/WildcardsWithDefault.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305") @TestDataPath("$PROJECT_ROOT") @@ -1197,5 +1413,177 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn } } } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld") + @TestDataPath("$PROJECT_ROOT") + public class JspecifyOld { + @Test + public void testAllFilesPresentInJspecifyOld() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations") + @TestDataPath("$PROJECT_ROOT") + public class ModuleAnnotations { + @Test + public void testAllFilesPresentInModuleAnnotations() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict") + @TestDataPath("$PROJECT_ROOT") + public class Strict { + @Test + public void testAllFilesPresentInStrict() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/strict/severalModulesDifferentPackages.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn") + @TestDataPath("$PROJECT_ROOT") + public class Warn { + @Test + public void testAllFilesPresentInWarn() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/basic.kt"); + } + + @Test + @TestMetadata("composeWithClassDefaultAnnotation.kt") + public void testComposeWithClassDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("composeWithPackageDefaultAnnotation.kt") + public void testComposeWithPackageDefaultAnnotation() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt"); + } + + @Test + @TestMetadata("dependentModulesNoNullMarked.kt") + public void testDependentModulesNoNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNoNullMarked.kt"); + } + + @Test + @TestMetadata("dependentModulesNullMarked.kt") + public void testDependentModulesNullMarked() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dependentModulesNullMarked.kt"); + } + + @Test + @TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt") + public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt"); + } + + @Test + @TestMetadata("dotNamedModule.kt") + public void testDotNamedModule() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/dotNamedModule.kt"); + } + + @Test + @TestMetadata("inheritanceAcrossModules.kt") + public void testInheritanceAcrossModules() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/inheritanceAcrossModules.kt"); + } + + @Test + @TestMetadata("nestedClasses.kt") + public void testNestedClasses() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/nestedClasses.kt"); + } + + @Test + @TestMetadata("overrideAtDeclarationLevel.kt") + public void testOverrideAtDeclarationLevel() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/overrideAtDeclarationLevel.kt"); + } + + @Test + @TestMetadata("severalModulesDifferentPackages.kt") + public void testSeveralModulesDifferentPackages() throws Exception { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java11Tests/jspecifyOld/moduleAnnotations/warn/severalModulesDifferentPackages.kt"); + } + } + } + } } }