Do not check visibility of enum entries in explicit api mode
Although they're instances of DeclarationDescriptorWithVisibility, they can't have visibilities #KT-37040 Fixed
This commit is contained in:
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@ class ExplicitApiDeclarationChecker : DeclarationChecker {
|
||||
if (state == ExplicitApiMode.DISABLED) return
|
||||
|
||||
if (descriptor !is DeclarationDescriptorWithVisibility) return
|
||||
if (descriptor is ClassDescriptor && descriptor.kind == ClassKind.ENUM_ENTRY) return // Enum entries does not have visibilities
|
||||
if (!descriptor.isEffectivelyPublicApi) return
|
||||
|
||||
checkVisibilityModifier(state, declaration, descriptor, context)
|
||||
|
||||
@@ -39,6 +39,11 @@ public data class FooData(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<!> {}
|
||||
}
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>
|
||||
class Nested<!> {}
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>
|
||||
inner class Inner<!> {}
|
||||
}
|
||||
|
||||
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>enum class Foo<!> { A, B }
|
||||
public enum class Bar { A, B }
|
||||
Reference in New Issue
Block a user