From 9a8fa300d7de326a29dff3bc9550ba6bae4e6552 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 24 Jun 2022 09:58:53 +0200 Subject: [PATCH] Add test for KT-52020 --- .../testData/cli/jvm/firDeprecationJava.args | 5 +++++ compiler/testData/cli/jvm/firDeprecationJava.kt | 7 +++++++ compiler/testData/cli/jvm/firDeprecationJava.out | 16 ++++++++++++++++ .../cli/jvm/firDeprecationJava/JavaClass.java | 13 +++++++++++++ .../jetbrains/kotlin/cli/CliTestGenerated.java | 5 +++++ 5 files changed, 46 insertions(+) create mode 100644 compiler/testData/cli/jvm/firDeprecationJava.args create mode 100644 compiler/testData/cli/jvm/firDeprecationJava.kt create mode 100644 compiler/testData/cli/jvm/firDeprecationJava.out create mode 100644 compiler/testData/cli/jvm/firDeprecationJava/JavaClass.java diff --git a/compiler/testData/cli/jvm/firDeprecationJava.args b/compiler/testData/cli/jvm/firDeprecationJava.args new file mode 100644 index 00000000000..1173c7c0664 --- /dev/null +++ b/compiler/testData/cli/jvm/firDeprecationJava.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/firDeprecationJava.kt +$TESTDATA_DIR$/firDeprecationJava +-Xuse-k2 +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firDeprecationJava.kt b/compiler/testData/cli/jvm/firDeprecationJava.kt new file mode 100644 index 00000000000..6bb58879571 --- /dev/null +++ b/compiler/testData/cli/jvm/firDeprecationJava.kt @@ -0,0 +1,7 @@ +fun foo() { + val thread = Thread() + thread.stop() + JavaClass().bar("", 1, 2.0) + val baz = JavaClass().baz + val jc = JavaClass("Omega") +} diff --git a/compiler/testData/cli/jvm/firDeprecationJava.out b/compiler/testData/cli/jvm/firDeprecationJava.out new file mode 100644 index 00000000000..4f8d2c6f3d3 --- /dev/null +++ b/compiler/testData/cli/jvm/firDeprecationJava.out @@ -0,0 +1,16 @@ +warning: ATTENTION! + This build uses experimental K2 compiler: + -Xuse-k2 +compiler/testData/cli/jvm/firDeprecationJava.kt:3:12: warning: '@R|kotlin/Deprecated|(...) public final fun stop(): R|kotlin/Unit| +' is deprecated. Deprecated in Java + thread.stop() + ^ +compiler/testData/cli/jvm/firDeprecationJava.kt:4:17: warning: '@R|kotlin/Deprecated|(...) public open fun bar(a: R|ft|, b: R|kotlin/Int|, c: R|kotlin/Double|): R|ft| +' is deprecated. Deprecated in Java + JavaClass().bar("", 1, 2.0) + ^ +compiler/testData/cli/jvm/firDeprecationJava.kt:5:27: warning: '@R|kotlin/Deprecated|(...) public open field baz: R|ft| +' is deprecated. Deprecated in Java + val baz = JavaClass().baz + ^ +OK diff --git a/compiler/testData/cli/jvm/firDeprecationJava/JavaClass.java b/compiler/testData/cli/jvm/firDeprecationJava/JavaClass.java new file mode 100644 index 00000000000..1ab77e1c1e4 --- /dev/null +++ b/compiler/testData/cli/jvm/firDeprecationJava/JavaClass.java @@ -0,0 +1,13 @@ +public class JavaClass { + @Deprecated + public String bar(String a, int b, double c) { + return a + b + c; + } + + @Deprecated + public List baz = null; + + public JavaClass() {} + + public JavaClass(String x) {} +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 2c1cf0cb12b..2e093b1fc49 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -374,6 +374,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/firAllOpenPlugin.args"); } + @TestMetadata("firDeprecationJava.args") + public void testFirDeprecationJava() throws Exception { + runTest("compiler/testData/cli/jvm/firDeprecationJava.args"); + } + @TestMetadata("firDfa.args") public void testFirDfa() throws Exception { runTest("compiler/testData/cli/jvm/firDfa.args");