Change NO_EXPLICIT_VISIBILITY_IN_API_MODE diagnostic range to 'declaration modifiers + name'.
Motivation: missing visibility modifier is an error in visibility modifiers list, so we should highlight this list. Including a name in the range is convenient for using alt+enter (you don't have to move cursor from name to fun/class/val keyword) Also change NO_EXPLICIT_RETURN_TYPE_IN_API_MODE diagnostic range to 'declaration name' to match corresponding IDE inspection. Fix stylistic problems and typos after review
This commit is contained in:
+1
-1
@@ -319,7 +319,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
@Argument(
|
||||
value = "-Xexplicit-api",
|
||||
valueDescription = "{strict|warning|disable}",
|
||||
description = "Force compiler to report errors an all public API declarations without explicit visibility.\n" +
|
||||
description = "Force compiler to report errors on all public API declarations without explicit visibility or return type.\n" +
|
||||
"Use 'warning' level to issue warnings instead of errors."
|
||||
)
|
||||
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
|
||||
|
||||
@@ -207,10 +207,10 @@ public interface Errors {
|
||||
DiagnosticFactory2<PsiElement, KtModifierKeywordToken, String> DEPRECATED_MODIFIER_FOR_TARGET = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory2<PsiElement, KtModifierKeywordToken, KtModifierKeywordToken> DEPRECATED_MODIFIER = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory2<PsiElement, KtModifierKeywordToken, String> REDUNDANT_MODIFIER_FOR_TARGET = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory1<KtDeclaration, DeclarationDescriptor> NO_EXPLICIT_VISIBILITY_IN_API_MODE = DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<KtDeclaration> NO_EXPLICIT_RETURN_TYPE_IN_API_MODE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory1<KtDeclaration, DeclarationDescriptor> NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING = DiagnosticFactory1.create(WARNING, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<KtDeclaration> NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<KtDeclaration> NO_EXPLICIT_VISIBILITY_IN_API_MODE = DiagnosticFactory0.create(ERROR, DECLARATION_MODIFIERS_AND_NAME);
|
||||
DiagnosticFactory0<KtNamedDeclaration> NO_EXPLICIT_RETURN_TYPE_IN_API_MODE = DiagnosticFactory0.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory0<KtDeclaration> NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING = DiagnosticFactory0.create(WARNING, DECLARATION_MODIFIERS_AND_NAME);
|
||||
DiagnosticFactory0<KtNamedDeclaration> NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING = DiagnosticFactory0.create(WARNING, DECLARATION_NAME);
|
||||
DiagnosticFactory2<PsiElement, KtModifierKeywordToken, String> WRONG_MODIFIER_CONTAINING_DECLARATION = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, KtModifierKeywordToken, String> DEPRECATED_MODIFIER_CONTAINING_DECLARATION = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory1<PsiElement, KtModifierKeywordToken> ILLEGAL_INLINE_PARAMETER_MODIFIER = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
@@ -187,6 +187,26 @@ object PositioningStrategies {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val DECLARATION_MODIFIERS_AND_NAME: PositioningStrategy<KtDeclaration> = object : DeclarationHeader<KtDeclaration>() {
|
||||
override fun mark(element: KtDeclaration): List<TextRange> {
|
||||
val startElement = element.firstChild
|
||||
val nameIdentifier = (element as? KtNamedDeclaration)?.nameIdentifier
|
||||
return if (nameIdentifier != null) {
|
||||
markRange(startElement, nameIdentifier)
|
||||
} else when (element) {
|
||||
// companion object/constructors without name
|
||||
is KtConstructor<*> -> {
|
||||
markRange(startElement, element.getConstructorKeyword() ?: element)
|
||||
}
|
||||
is KtObjectDeclaration -> {
|
||||
markRange(startElement, element.getObjectKeyword() ?: element)
|
||||
}
|
||||
else -> DEFAULT.mark(element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val DECLARATION_NAME: PositioningStrategy<KtNamedDeclaration> = object : DeclarationHeader<KtNamedDeclaration>() {
|
||||
override fun mark(element: KtNamedDeclaration): List<TextRange> {
|
||||
@@ -195,7 +215,7 @@ object PositioningStrategies {
|
||||
if (element is KtClassOrObject) {
|
||||
val startElement =
|
||||
element.getModifierList()?.getModifier(KtTokens.ENUM_KEYWORD)
|
||||
?: element.node.findChildByType(TokenSet.create(KtTokens.CLASS_KEYWORD, KtTokens.OBJECT_KEYWORD))?.psi
|
||||
?: element.node.findChildByType(TokenSet.create(KtTokens.CLASS_KEYWORD, KtTokens.OBJECT_KEYWORD))?.psi
|
||||
?: element
|
||||
|
||||
return markRange(startElement, nameIdentifier)
|
||||
|
||||
+4
-4
@@ -119,10 +119,10 @@ public class DefaultErrorMessages {
|
||||
MAP.put(DEPRECATED_MODIFIER_FOR_TARGET, "Modifier ''{0}'' is deprecated for ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(DEPRECATED_MODIFIER, "Modifier ''{0}'' is deprecated, use ''{1}'' instead", TO_STRING, TO_STRING);
|
||||
MAP.put(REDUNDANT_MODIFIER_FOR_TARGET, "Modifier ''{0}'' is redundant for ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(NO_EXPLICIT_VISIBILITY_IN_API_MODE, "Declaration ''{0}'' is effectively public API and API mode is on, but no visibility is specified", NAME);
|
||||
MAP.put(NO_EXPLICIT_RETURN_TYPE_IN_API_MODE, "This declaration is effectively public API and API mode is on, but no explicit return type is specified");
|
||||
MAP.put(NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING, "Declaration ''{0}'' is effectively public API and API mode is on, but no visibility is specified", NAME);
|
||||
MAP.put(NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING, "This declaration is effectively public API and API mode is on, but no explicit return type is specified");
|
||||
MAP.put(NO_EXPLICIT_VISIBILITY_IN_API_MODE, "Visibility must be specified in explicit API mode");
|
||||
MAP.put(NO_EXPLICIT_RETURN_TYPE_IN_API_MODE, "Return type must be specified in explicit API mode");
|
||||
MAP.put(NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING, "Visibility must be specified in explicit API mode");
|
||||
MAP.put(NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING, "Return type must be specified in explicit API mode");
|
||||
MAP.put(WRONG_MODIFIER_CONTAINING_DECLARATION, "Modifier ''{0}'' is not applicable inside ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(DEPRECATED_MODIFIER_CONTAINING_DECLARATION, "Modifier ''{0}'' is deprecated inside ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(ILLEGAL_INLINE_PARAMETER_MODIFIER, "Modifier ''{0}'' is allowed only for function parameters of an inline function", TO_STRING);
|
||||
|
||||
+19
-28
@@ -7,11 +7,9 @@ package org.jetbrains.kotlin.resolve.checkers
|
||||
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.ExplicitApiMode
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnce
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifier
|
||||
@@ -19,11 +17,11 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPublicApi
|
||||
|
||||
class ExplicitApiDeclarationChecker : DeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
val state = isEnabled(context.languageVersionSettings)
|
||||
val state = context.languageVersionSettings.getFlag(AnalysisFlags.explicitApiMode)
|
||||
if (state == ExplicitApiMode.DISABLED) return
|
||||
|
||||
val isApi = (descriptor as? DeclarationDescriptorWithVisibility)?.isEffectivelyPublicApi ?: return
|
||||
if (!isApi) return
|
||||
if (descriptor !is DeclarationDescriptorWithVisibility) return
|
||||
if (!descriptor.isEffectivelyPublicApi) return
|
||||
|
||||
checkVisibilityModifier(state, declaration, descriptor, context)
|
||||
checkExplicitReturnType(state, declaration, descriptor, context)
|
||||
@@ -35,16 +33,16 @@ class ExplicitApiDeclarationChecker : DeclarationChecker {
|
||||
descriptor: DeclarationDescriptorWithVisibility,
|
||||
context: DeclarationCheckerContext
|
||||
) {
|
||||
val modifier = declaration.visibilityModifier()?.node?.elementType as? KtModifierKeywordToken
|
||||
val modifier = declaration.visibilityModifier()
|
||||
if (modifier != null) return
|
||||
|
||||
if (excludeForDiagnostic(descriptor)) return
|
||||
val diagnostic =
|
||||
if (state == ExplicitApiMode.STRICT)
|
||||
Errors.NO_EXPLICIT_VISIBILITY_IN_API_MODE.on(declaration, descriptor)
|
||||
Errors.NO_EXPLICIT_VISIBILITY_IN_API_MODE
|
||||
else
|
||||
Errors.NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING.on(declaration, descriptor)
|
||||
context.trace.reportDiagnosticOnce(diagnostic)
|
||||
Errors.NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING
|
||||
context.trace.reportDiagnosticOnce(diagnostic.on(declaration))
|
||||
}
|
||||
|
||||
private fun checkExplicitReturnType(
|
||||
@@ -65,11 +63,10 @@ class ExplicitApiDeclarationChecker : DeclarationChecker {
|
||||
if (shouldReport) {
|
||||
val diagnostic =
|
||||
if (state == ExplicitApiMode.STRICT)
|
||||
Errors.NO_EXPLICIT_RETURN_TYPE_IN_API_MODE.on(declaration)
|
||||
Errors.NO_EXPLICIT_RETURN_TYPE_IN_API_MODE
|
||||
else
|
||||
Errors.NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING
|
||||
.on(declaration)
|
||||
context.trace.reportDiagnosticOnce(diagnostic)
|
||||
context.trace.reportDiagnosticOnce(diagnostic.on(declaration))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,29 +88,23 @@ class ExplicitApiDeclarationChecker : DeclarationChecker {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun isEnabled(settings: LanguageVersionSettings): ExplicitApiMode {
|
||||
return settings.getFlag(AnalysisFlags.explicitApiMode)
|
||||
}
|
||||
|
||||
fun returnTypeRequired(
|
||||
element: KtCallableDeclaration,
|
||||
descriptor: DeclarationDescriptor?,
|
||||
checkForPublicApi: Boolean,
|
||||
checkForInternal: Boolean,
|
||||
checkForPrivate: Boolean
|
||||
): Boolean =
|
||||
element.containingClassOrObject?.isLocal != true &&
|
||||
when (element) {
|
||||
is KtFunction -> !element.isLocal
|
||||
is KtProperty -> !element.isLocal
|
||||
else -> false
|
||||
} && run {
|
||||
val callableMemberDescriptor = descriptor as? CallableMemberDescriptor
|
||||
): Boolean {
|
||||
if (element.containingClassOrObject?.isLocal == true) return false
|
||||
if (element is KtFunction && element.isLocal) return false
|
||||
if (element is KtProperty && element.isLocal) return false
|
||||
|
||||
val visibility = callableMemberDescriptor?.effectiveVisibility()?.toVisibility()
|
||||
(checkForPublicApi && visibility?.isPublicAPI == true) || (checkForInternal && visibility == Visibilities.INTERNAL) ||
|
||||
(checkForPrivate && visibility == Visibilities.PRIVATE)
|
||||
}
|
||||
val callableMemberDescriptor = descriptor as? CallableMemberDescriptor
|
||||
|
||||
val visibility = callableMemberDescriptor?.effectiveVisibility()?.toVisibility()
|
||||
return (checkForPublicApi && visibility?.isPublicAPI == true) || (checkForInternal && visibility == Visibilities.INTERNAL) ||
|
||||
(checkForPrivate && visibility == Visibilities.PRIVATE)
|
||||
}
|
||||
|
||||
fun returnTypeCheckIsApplicable(element: KtCallableDeclaration): Boolean {
|
||||
if (element.containingFile is KtCodeFragment) return false
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ where advanced options include:
|
||||
-Xeffect-system Enable experimental language feature: effect system
|
||||
-Xexperimental=<fq.name> Enable and propagate usages of experimental API for marker annotation with the given fully qualified name
|
||||
-Xexplicit-api={strict|warning|disable}
|
||||
Force compiler to report errors an all public API declarations without explicit visibility.
|
||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||
Use 'warning' level to issue warnings instead of errors.
|
||||
-Xinline-classes Enable experimental inline classes
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ where advanced options include:
|
||||
-Xeffect-system Enable experimental language feature: effect system
|
||||
-Xexperimental=<fq.name> Enable and propagate usages of experimental API for marker annotation with the given fully qualified name
|
||||
-Xexplicit-api={strict|warning|disable}
|
||||
Force compiler to report errors an all public API declarations without explicit visibility.
|
||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||
Use 'warning' level to issue warnings instead of errors.
|
||||
-Xinline-classes Enable experimental inline classes
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
class <!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>Foo1()<!> {}
|
||||
// SKIP_TXT
|
||||
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>class Foo1<!>() {}
|
||||
|
||||
public class Foo2() {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun method()<!> {}
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun method<!>() {}
|
||||
public fun method2() {}
|
||||
private fun method3() {}
|
||||
|
||||
<!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE, NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun implicit()<!> = 10
|
||||
<!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>public fun implicit2()<!> = 10
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun <!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>implicit<!><!>() = 10
|
||||
public fun <!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>implicit2<!>() = 10
|
||||
public fun implicit3(): Int = 10
|
||||
}
|
||||
|
||||
public data class FooData(val i: Int, val s: String)
|
||||
|
||||
data class <!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>FooData2(val i: Int, val s: String)<!>
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>data class FooData2<!>(val i: Int, val s: String)
|
||||
|
||||
public class WithNested {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>class Nested<!> {}
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>inner class Inner<!> {}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
// SKIP_TXT
|
||||
|
||||
public class Bar {
|
||||
companion <!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>object<!> {}
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>companion object<!> {}
|
||||
}
|
||||
|
||||
public class Bar2 {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>companion object MyCompanion<!> {}
|
||||
}
|
||||
|
||||
public class Bar3 {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>object NestedObject<!> {}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
// SKIP_TXT
|
||||
|
||||
public class Foo1 () {}
|
||||
public class Foo2 constructor() {}
|
||||
public class Foo3 public constructor() {}
|
||||
public class Foo4 private constructor() {}
|
||||
|
||||
public class Foo5 {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>constructor()<!> {}
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>constructor<!>() {}
|
||||
}
|
||||
|
||||
public class Foo6 {
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_FEATURE_WARNING
|
||||
// SKIP_TXT
|
||||
|
||||
inline class <!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>Value1(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val inner: Int<!>)<!>
|
||||
public inline class Value2(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val inner: Int<!>)
|
||||
inline class <!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>Value3(public val inner: Int)<!>
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>inline class Value1<!>(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val inner<!>: Int)
|
||||
public inline class Value2(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val inner<!>: Int)
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>inline class Value3<!>(public val inner: Int)
|
||||
public inline class Value4(public val inner: Int)
|
||||
@@ -1,33 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
interface <!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>I1<!> {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun i()<!>
|
||||
// SKIP_TXT
|
||||
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>interface I1<!> {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun i<!>()
|
||||
}
|
||||
|
||||
public interface I2 {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun i()<!>
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun i<!>()
|
||||
}
|
||||
|
||||
public interface I3 {
|
||||
@@ -23,8 +25,8 @@ public class Impl: I3 {
|
||||
}
|
||||
|
||||
public class Impl2: I4 {
|
||||
<!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>override fun i()<!> = 10
|
||||
<!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>override val v<!> = 10
|
||||
override fun <!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>i<!>() = 10
|
||||
override val <!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>v<!> = 10
|
||||
}
|
||||
|
||||
private class PrivateImpl: I4 {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// SKIP_TXT
|
||||
|
||||
private class Foo {
|
||||
fun method() {}
|
||||
}
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package
|
||||
|
||||
public fun f(): kotlin.Unit
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
public interface I {
|
||||
public abstract fun bar(): 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
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
public class Foo(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val bar: Int<!>, private var bar2: String, internal var bar3: Long, public var bar4: Int) {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>var simple: Int<!> = 10
|
||||
// SKIP_TXT
|
||||
|
||||
public class Foo(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val bar<!>: Int, private var bar2: String, internal var bar3: Long, public var bar4: Int) {
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>var simple<!>: Int = 10
|
||||
public var simple2: Int = 10
|
||||
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val withGetter: Int<!>
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val withGetter<!>: Int
|
||||
get() = 10
|
||||
|
||||
public val withGetter2: Int
|
||||
get() = 10
|
||||
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>var getterAndSetter: Int<!> = 10
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>var getterAndSetter<!>: Int = 10
|
||||
get() = field
|
||||
set(v) { field = v }
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun foo()<!> {}
|
||||
// SKIP_TXT
|
||||
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun foo<!>() {}
|
||||
|
||||
public fun foo2() {}
|
||||
|
||||
<!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE, NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun bar()<!> = 10
|
||||
<!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>public fun bar2()<!> = 10
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>fun <!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>bar<!><!>() = 10
|
||||
public fun <!NO_EXPLICIT_RETURN_TYPE_IN_API_MODE!>bar2<!>() = 10
|
||||
public fun bar3(): Int = 10
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
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
|
||||
+2
-2
@@ -16,8 +16,8 @@ abstract class AbstractDiagnosticsWithExplicitApi : AbstractDiagnosticsTest() {
|
||||
override fun defaultLanguageVersionSettings(): LanguageVersionSettings =
|
||||
CompilerTestLanguageVersionSettings(
|
||||
DEFAULT_DIAGNOSTIC_TESTS_FEATURES,
|
||||
ApiVersion.KOTLIN_1_3,
|
||||
LanguageVersion.KOTLIN_1_3,
|
||||
LanguageVersionSettingsImpl.DEFAULT.apiVersion,
|
||||
LanguageVersionSettingsImpl.DEFAULT.languageVersion,
|
||||
mapOf(AnalysisFlags.explicitApiMode to ExplicitApiMode.STRICT)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user