From 5b0cb5c9db35304565eca63a4804103200aee8d7 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 14 Mar 2024 09:36:11 +0100 Subject: [PATCH] K2/jspecify: reproduce KT-65594 --- ...nAnnotationsCompiledJavaTestGenerated.java | 12 +++++++++++ ...dJavaWithPsiClassReadingTestGenerated.java | 12 +++++++++++ ...ignAnnotationsSourceJavaTestGenerated.java | 12 +++++++++++ .../strictMode/NullMarkedWithStarType.fir.kt | 20 +++++++++++++++++++ .../strictMode/NullMarkedWithStarType.kt | 20 +++++++++++++++++++ .../warnMode/NullMarkedWithStarType.fir.kt | 20 +++++++++++++++++++ .../warnMode/NullMarkedWithStarType.kt | 20 +++++++++++++++++++ ...nAnnotationsCompiledJavaTestGenerated.java | 12 +++++++++++ ...dJavaWithPsiClassReadingTestGenerated.java | 12 +++++++++++ ...ignAnnotationsSourceJavaTestGenerated.java | 12 +++++++++++ 10 files changed, 152 insertions(+) create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.fir.kt create mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java index 5df26309885..4e09c07ea18 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated.java @@ -750,6 +750,12 @@ public class FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated extend runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { @@ -850,6 +856,12 @@ public class FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated extend runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java index 05581df468b..8ffecc3bac5 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated.java @@ -808,6 +808,12 @@ public class FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingT runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { @@ -908,6 +914,12 @@ public class FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingT runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated.java index 6b9529062f8..b3d9db5b676 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated.java @@ -808,6 +808,12 @@ public class FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated extends runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { @@ -908,6 +914,12 @@ public class FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated extends runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.fir.kt new file mode 100644 index 00000000000..ae0e41e2640 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.fir.kt @@ -0,0 +1,20 @@ +// JSPECIFY_STATE: strict +// FILE: Box.java + +import org.jspecify.annotations.*; + +@NullMarked +public class Box { + public static Box make() { + return new Box<>(); + } +} + +// FILE: Util.java +public final class Util { + public Box boxId(Box box) { return box; } +} + +// FILE: a.kt +fun foo(u: Util) = + u.boxId(Box.make()) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt new file mode 100644 index 00000000000..3016e74a14c --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt @@ -0,0 +1,20 @@ +// JSPECIFY_STATE: strict +// FILE: Box.java + +import org.jspecify.annotations.*; + +@NullMarked +public class Box { + public static Box make() { + return new Box<>(); + } +} + +// FILE: Util.java +public final class Util { + public Box boxId(Box box) { return box; } +} + +// FILE: a.kt +fun foo(u: Util) = + u.boxId(Box.make()) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.fir.kt new file mode 100644 index 00000000000..6c416d2004a --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.fir.kt @@ -0,0 +1,20 @@ +// JSPECIFY_STATE: warn +// FILE: Box.java + +import org.jspecify.annotations.*; + +@NullMarked +public class Box { + public static Box make() { + return new Box<>(); + } +} + +// FILE: Util.java +public final class Util { + public Box boxId(Box box) { return box; } +} + +// FILE: a.kt +fun foo(u: Util) = + u.boxId(Box.make()) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt new file mode 100644 index 00000000000..b402eb0f232 --- /dev/null +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt @@ -0,0 +1,20 @@ +// JSPECIFY_STATE: warn +// FILE: Box.java + +import org.jspecify.annotations.*; + +@NullMarked +public class Box { + public static Box make() { + return new Box<>(); + } +} + +// FILE: Util.java +public final class Util { + public Box boxId(Box box) { return box; } +} + +// FILE: a.kt +fun foo(u: Util) = + u.boxId(Box.make()) 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 01ed1f695af..8b007a61409 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 @@ -750,6 +750,12 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { @@ -850,6 +856,12 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { 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 0f9a9a1483a..21c18031e92 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 @@ -808,6 +808,12 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { @@ -908,6 +914,12 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { 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 6d032f16752..f3400a66723 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 @@ -808,6 +808,12 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() { @@ -908,6 +914,12 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NonPlatformTypeParameter.kt"); } + @Test + @TestMetadata("NullMarkedWithStarType.kt") + public void testNullMarkedWithStarType() { + runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/warnMode/NullMarkedWithStarType.kt"); + } + @Test @TestMetadata("NullnessUnspecifiedTypeParameter.kt") public void testNullnessUnspecifiedTypeParameter() {