diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExplicitApiDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExplicitApiDeclarationChecker.kt index 67f21772e6e..3bfbb4b76bd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExplicitApiDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExplicitApiDeclarationChecker.kt @@ -76,17 +76,15 @@ class ExplicitApiDeclarationChecker : DeclarationChecker { /** * Exclusion list: * 1. Primary constructors of public API classes - * 2. Members of public API interfaces - * 3. do not report overrides of public API? effectively, this means 'no report on overrides at all' + * 2. Properties of data classes in public API + * 3. Overrides of public API. Effectively, this means 'no report on overrides at all' * 4. Getters and setters (because getters can't change visibility and setter-only explicit visibility looks ugly) * * Do we need something like @PublicApiFile to disable (or invert) this inspection per-file? */ private fun excludeForDiagnostic(descriptor: DeclarationDescriptor): Boolean { /* 1. */ if ((descriptor as? ClassConstructorDescriptor)?.isPrimary == true) return true - val isMemberOfPublicInterface = - (descriptor.containingDeclaration as? ClassDescriptor)?.let { DescriptorUtils.isInterface(it) && it.effectiveVisibility().publicApi } - /* 2. */ if (descriptor is CallableDescriptor && isMemberOfPublicInterface == true) return true + /* 2. */ if (descriptor is PropertyDescriptor && (descriptor.containingDeclaration as? ClassDescriptor)?.isData == true) return true /* 3. */ if ((descriptor as? CallableDescriptor)?.overriddenDescriptors?.isNotEmpty() == true) return true /* 4. */ if (descriptor is PropertyAccessorDescriptor) return true return false diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/classes.kt b/compiler/testData/diagnostics/testsWithExplicitApi/classes.kt new file mode 100644 index 00000000000..230b914da73 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/classes.kt @@ -0,0 +1,15 @@ +class Foo1() {} + +public class Foo2() { + fun method() {} + public fun method2() {} + private fun method3() {} + + fun implicit() = 10 + public fun implicit2() = 10 + public fun implicit3(): Int = 10 +} + +public data class FooData(val i: Int, val s: String) + +data class FooData2(val i: Int, val s: String) \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/classes.txt b/compiler/testData/diagnostics/testsWithExplicitApi/classes.txt new file mode 100644 index 00000000000..ad52805938f --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/classes.txt @@ -0,0 +1,45 @@ +package + +public final class Foo1 { + public constructor Foo1() + 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 Foo2 { + public constructor Foo2() + 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 final fun implicit(): kotlin.Int + public final fun implicit2(): kotlin.Int + public final fun implicit3(): kotlin.Int + public final fun method(): kotlin.Unit + public final fun method2(): kotlin.Unit + private final fun method3(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final data class FooData { + public constructor FooData(/*0*/ i: kotlin.Int, /*1*/ s: kotlin.String) + public final val i: kotlin.Int + public final val s: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.Int + public final operator /*synthesized*/ fun component2(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ i: kotlin.Int = ..., /*1*/ s: kotlin.String = ...): FooData + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +public final data class FooData2 { + public constructor FooData2(/*0*/ i: kotlin.Int, /*1*/ s: kotlin.String) + public final val i: kotlin.Int + public final val s: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.Int + public final operator /*synthesized*/ fun component2(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ i: kotlin.Int = ..., /*1*/ s: kotlin.String = ...): FooData2 + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/companionObject.kt b/compiler/testData/diagnostics/testsWithExplicitApi/companionObject.kt new file mode 100644 index 00000000000..51a415c9c61 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/companionObject.kt @@ -0,0 +1,3 @@ +public class Bar { + companion object {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/companionObject.txt b/compiler/testData/diagnostics/testsWithExplicitApi/companionObject.txt new file mode 100644 index 00000000000..cba12da82ca --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/companionObject.txt @@ -0,0 +1,15 @@ +package + +public final class Bar { + public constructor 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 + + public companion object Companion { + private constructor Companion() + 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/testsWithExplicitApi/constructors.kt b/compiler/testData/diagnostics/testsWithExplicitApi/constructors.kt new file mode 100644 index 00000000000..eaf408ff998 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/constructors.kt @@ -0,0 +1,12 @@ +public class Foo1 () {} +public class Foo2 constructor() {} +public class Foo3 public constructor() {} +public class Foo4 private constructor() {} + +public class Foo5 { + constructor() {} +} + +public class Foo6 { + public constructor() {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/constructors.txt b/compiler/testData/diagnostics/testsWithExplicitApi/constructors.txt new file mode 100644 index 00000000000..41cb9562332 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/constructors.txt @@ -0,0 +1,43 @@ +package + +public final class Foo1 { + public constructor Foo1() + 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 Foo2 { + public constructor Foo2() + 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 Foo3 { + public constructor Foo3() + 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 Foo4 { + private constructor Foo4() + 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 Foo5 { + public constructor Foo5() + 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 Foo6 { + public constructor Foo6() + 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/testsWithExplicitApi/inlineClasses.kt b/compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.kt new file mode 100644 index 00000000000..03b84f05fb8 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.kt @@ -0,0 +1,6 @@ +// !DIAGNOSTICS: -EXPERIMENTAL_FEATURE_WARNING + +inline class Value1(val inner: Int) +public inline class Value2(val inner: Int) +inline class Value3(public val inner: Int) +public inline class Value4(public val inner: Int) \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.txt b/compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.txt new file mode 100644 index 00000000000..0d9eedbb57c --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.txt @@ -0,0 +1,33 @@ +package + +public final inline class Value1 { + public constructor Value1(/*0*/ inner: kotlin.Int) + public final val inner: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +public final inline class Value2 { + public constructor Value2(/*0*/ inner: kotlin.Int) + public final val inner: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +public final inline class Value3 { + public constructor Value3(/*0*/ inner: kotlin.Int) + public final val inner: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +public final inline class Value4 { + public constructor Value4(/*0*/ inner: kotlin.Int) + public final val inner: kotlin.Int + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/interfaces.kt b/compiler/testData/diagnostics/testsWithExplicitApi/interfaces.kt new file mode 100644 index 00000000000..582557684ee --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/interfaces.kt @@ -0,0 +1,33 @@ +interface I1 { + fun i() +} + +public interface I2 { + fun i() +} + +public interface I3 { + public fun i() + public val v: Int +} + +public interface I4 { + public fun i(): Int + public val v: Int +} + +public class Impl: I3 { + override fun i() {} + override val v: Int + get() = 10 +} + +public class Impl2: I4 { + override fun i() = 10 + override val v = 10 +} + +private class PrivateImpl: I4 { + override fun i() = 10 + override val v = 10 +} diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/interfaces.txt b/compiler/testData/diagnostics/testsWithExplicitApi/interfaces.txt new file mode 100644 index 00000000000..e9cb14fcdf9 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/interfaces.txt @@ -0,0 +1,58 @@ +package + +public interface I1 { + 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 i(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface I2 { + 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 i(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface I3 { + public abstract val v: 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 abstract fun i(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface I4 { + public abstract val v: 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 abstract fun i(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Impl : I3 { + public constructor Impl() + public open override /*1*/ val v: 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*/ fun i(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Impl2 : I4 { + public constructor Impl2() + public open override /*1*/ val v: kotlin.Int = 10 + 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*/ fun i(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +private final class PrivateImpl : I4 { + public constructor PrivateImpl() + public open override /*1*/ val v: kotlin.Int = 10 + 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*/ fun i(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.kt b/compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.kt new file mode 100644 index 00000000000..aab3f871705 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.kt @@ -0,0 +1,3 @@ +private class Foo { + fun method() {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.txt b/compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.txt new file mode 100644 index 00000000000..caec90ec3d0 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.txt @@ -0,0 +1,9 @@ +package + +private final 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 final fun method(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/properties.kt b/compiler/testData/diagnostics/testsWithExplicitApi/properties.kt new file mode 100644 index 00000000000..18de84ff17e --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/properties.kt @@ -0,0 +1,18 @@ +public class Foo(val bar: Int, private var bar2: String, internal var bar3: Long, public var bar4: Int) { + var simple: Int = 10 + public var simple2: Int = 10 + + val withGetter: Int + get() = 10 + + public val withGetter2: Int + get() = 10 + + var getterAndSetter: Int = 10 + get() = field + set(v) { field = v } + + public var getterAndSetter2: Int = 10 + get() = field + set(v) { field = v } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/properties.txt b/compiler/testData/diagnostics/testsWithExplicitApi/properties.txt new file mode 100644 index 00000000000..6c89e0f596a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/properties.txt @@ -0,0 +1,18 @@ +package + +public final class Foo { + public constructor Foo(/*0*/ bar: kotlin.Int, /*1*/ bar2: kotlin.String, /*2*/ bar3: kotlin.Long, /*3*/ bar4: kotlin.Int) + public final val bar: kotlin.Int + private final var bar2: kotlin.String + internal final var bar3: kotlin.Long + public final var bar4: kotlin.Int + public final var getterAndSetter: kotlin.Int + public final var getterAndSetter2: kotlin.Int + public final var simple: kotlin.Int + public final var simple2: kotlin.Int + public final val withGetter: kotlin.Int + public final val withGetter2: 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/testsWithExplicitApi/toplevel.kt b/compiler/testData/diagnostics/testsWithExplicitApi/toplevel.kt new file mode 100644 index 00000000000..d48da0a52eb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/toplevel.kt @@ -0,0 +1,7 @@ +fun foo() {} + +public fun foo2() {} + +fun bar() = 10 +public fun bar2() = 10 +public fun bar3(): Int = 10 diff --git a/compiler/testData/diagnostics/testsWithExplicitApi/toplevel.txt b/compiler/testData/diagnostics/testsWithExplicitApi/toplevel.txt new file mode 100644 index 00000000000..f9b2c5ff815 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithExplicitApi/toplevel.txt @@ -0,0 +1,7 @@ +package + +public fun bar(): kotlin.Int +public fun bar2(): kotlin.Int +public fun bar3(): kotlin.Int +public fun foo(): kotlin.Unit +public fun foo2(): kotlin.Unit diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithExplicitApi.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithExplicitApi.kt new file mode 100644 index 00000000000..9a2e29e740e --- /dev/null +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsWithExplicitApi.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.checkers + +import org.jetbrains.kotlin.config.* +import org.jetbrains.kotlin.test.ConfigurationKind + +abstract class AbstractDiagnosticsWithExplicitApi : AbstractDiagnosticsTest() { + override fun getConfigurationKind(): ConfigurationKind { + return ConfigurationKind.NO_KOTLIN_REFLECT + } + + override fun defaultLanguageVersionSettings(): LanguageVersionSettings = + CompilerTestLanguageVersionSettings( + DEFAULT_DIAGNOSTIC_TESTS_FEATURES, + ApiVersion.KOTLIN_1_3, + LanguageVersion.KOTLIN_1_3, + mapOf(AnalysisFlags.explicitApiMode to ExplicitApiMode.STRICT) + ) +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java new file mode 100644 index 00000000000..722d129d378 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsWithExplicitApiGenerated.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.checkers; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/diagnostics/testsWithExplicitApi") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class DiagnosticsWithExplicitApiGenerated extends AbstractDiagnosticsWithExplicitApi { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInTestsWithExplicitApi() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithExplicitApi"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("classes.kt") + public void testClasses() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/classes.kt"); + } + + @TestMetadata("companionObject.kt") + public void testCompanionObject() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/companionObject.kt"); + } + + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/constructors.kt"); + } + + @TestMetadata("inlineClasses.kt") + public void testInlineClasses() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.kt"); + } + + @TestMetadata("interfaces.kt") + public void testInterfaces() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/interfaces.kt"); + } + + @TestMetadata("mustBeEffectivelyPublic.kt") + public void testMustBeEffectivelyPublic() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.kt"); + } + + @TestMetadata("properties.kt") + public void testProperties() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/properties.kt"); + } + + @TestMetadata("toplevel.kt") + public void testToplevel() throws Exception { + runTest("compiler/testData/diagnostics/testsWithExplicitApi/toplevel.kt"); + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index a3ed5934ba7..6390d340d84 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -111,6 +111,10 @@ fun main(args: Array) { model("diagnostics/testsWithUnsignedTypes") } + testClass { + model("diagnostics/testsWithExplicitApi") + } + testClass { model("multiplatform", extension = null, recursive = true, excludeParentDirs = true) }