From eb745133c9a71d78df5e7fb30be40bf52f9ccb15 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Tue, 10 Jul 2018 13:10:34 +0200 Subject: [PATCH] Switch @JvmStatic diagnostic test to LanguageFeature usage --- .../jvmStatic/constructorProperty.kt | 1 + .../jvmStatic/constructorProperty_LL13.kt | 4 ++ .../jvmStatic/constructorProperty_LL13.txt | 9 ++++ .../annotations/jvmStatic/functions.kt | 1 + .../jvmStatic/interfaceCompanion_LL12.kt | 1 + .../annotations/jvmStatic/localFun.kt | 1 + .../annotations/jvmStatic/localFun_LL13.kt | 7 +++ .../annotations/jvmStatic/localFun_LL13.txt | 3 ++ .../annotations/jvmStatic/property.kt | 1 + .../annotations/jvmStatic/property_LL13.kt | 45 +++++++++++++++++++ .../annotations/jvmStatic/property_LL13.txt | 42 +++++++++++++++++ .../DiagnosticsTestWithStdLibGenerated.java | 15 +++++++ ...ticsTestWithStdLibUsingJavacGenerated.java | 15 +++++++ 13 files changed, 145 insertions(+) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.txt diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty.kt index 6342e78c9e0..473550c1eb8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -JvmStaticInInterface class A(@JvmStatic val z: Int) { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.kt new file mode 100644 index 00000000000..c869dd54273 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.kt @@ -0,0 +1,4 @@ +// !LANGUAGE: +JvmStaticInInterface +class A(@JvmStatic val z: Int) { + +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.txt new file mode 100644 index 00000000000..82132e04320 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.txt @@ -0,0 +1,9 @@ +package + +public final class A { + public constructor A(/*0*/ z: kotlin.Int) + @kotlin.jvm.JvmStatic public final val z: kotlin.Int + 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/testsWithStdLib/annotations/jvmStatic/functions.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions.kt index a689d8ddf84..fbbede0ab34 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -JvmStaticInInterface // !DIAGNOSTICS: -UNUSED_VARIABLE class A { companion object { diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL12.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL12.kt index 05041754e68..e2321c70673 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL12.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL12.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -JvmStaticInInterface // !DIAGNOSTICS: -UNUSED_VARIABLE interface B { companion object { diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun.kt index 0ac1719c537..6f1d592d7f3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -JvmStaticInInterface // !DIAGNOSTICS: -UNUSED_VARIABLE fun main(args: Array) { @JvmStatic fun a(){ diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.kt new file mode 100644 index 00000000000..9254b901acb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.kt @@ -0,0 +1,7 @@ +// !LANGUAGE: +JvmStaticInInterface +// !DIAGNOSTICS: -UNUSED_VARIABLE +fun main(args: Array) { + @JvmStatic fun a(){ + + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.txt new file mode 100644 index 00000000000..49ba831837b --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.txt @@ -0,0 +1,3 @@ +package + +public fun main(/*0*/ args: kotlin.Array): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt index f97c1072cce..90e0a981724 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -JvmStaticInInterface // !DIAGNOSTICS: -UNUSED_VARIABLE open class B { public open val base1 : Int = 1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt new file mode 100644 index 00000000000..5a24dff30ee --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt @@ -0,0 +1,45 @@ +// !LANGUAGE: +JvmStaticInInterface +// !DIAGNOSTICS: -UNUSED_VARIABLE +open class B { + public open val base1 : Int = 1 + public open val base2 : Int = 1 +} + +class A { + companion object : B() { + var p1:Int = 1 + @JvmStatic set(p: Int) { + p1 = 1 + } + + @JvmStatic val z = 1; + + @JvmStatic override val base1: Int = 0 + + override val base2: Int = 0 + @JvmStatic get + } + + object A : B() { + var p:Int = 1 + @JvmStatic set(p1: Int) { + p = 1 + } + + @JvmStatic val z = 1; + + @JvmStatic override val base1: Int = 0 + + @JvmStatic open fun f() {} + + override val base2: Int = 0 + @JvmStatic get + } + + var p:Int = 1 + @JvmStatic set(p1: Int) { + p = 1 + } + + @JvmStatic val z2 = 1; +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.txt new file mode 100644 index 00000000000..2c28ded48cc --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.txt @@ -0,0 +1,42 @@ +package + +public final class A { + public constructor A() + public final var p: kotlin.Int + @kotlin.jvm.JvmStatic public final val z2: kotlin.Int = 1 + 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 object A : B { + private constructor A() + @kotlin.jvm.JvmStatic public open override /*1*/ val base1: kotlin.Int = 0 + public open override /*1*/ val base2: kotlin.Int = 0 + public final var p: kotlin.Int + @kotlin.jvm.JvmStatic public final val z: kotlin.Int = 1 + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + @kotlin.jvm.JvmStatic public open fun f(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public companion object Companion : B { + private constructor Companion() + @kotlin.jvm.JvmStatic public open override /*1*/ val base1: kotlin.Int = 0 + public open override /*1*/ val base2: kotlin.Int = 0 + public final var p1: kotlin.Int + @kotlin.jvm.JvmStatic public final val z: kotlin.Int = 1 + 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 val base1: kotlin.Int = 1 + public open val base2: kotlin.Int = 1 + 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/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 726b72a97a3..51b16c95d7a 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -648,6 +648,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty.kt"); } + @TestMetadata("constructorProperty_LL13.kt") + public void testConstructorProperty_LL13() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.kt"); + } + @TestMetadata("constructors.kt") public void testConstructors() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructors.kt"); @@ -688,10 +693,20 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun.kt"); } + @TestMetadata("localFun_LL13.kt") + public void testLocalFun_LL13() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.kt"); + } + @TestMetadata("property.kt") public void testProperty() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt"); } + + @TestMetadata("property_LL13.kt") + public void testProperty_LL13() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt"); + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/kClass") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index d1b8cd2ef22..efe0eee4e30 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -648,6 +648,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty.kt"); } + @TestMetadata("constructorProperty_LL13.kt") + public void testConstructorProperty_LL13() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructorProperty_LL13.kt"); + } + @TestMetadata("constructors.kt") public void testConstructors() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/constructors.kt"); @@ -688,10 +693,20 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun.kt"); } + @TestMetadata("localFun_LL13.kt") + public void testLocalFun_LL13() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/localFun_LL13.kt"); + } + @TestMetadata("property.kt") public void testProperty() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt"); } + + @TestMetadata("property_LL13.kt") + public void testProperty_LL13() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt"); + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/kClass")