Make internal: don't suggest for @JvmField property inside companion object of interface #KT-27138 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-11-27 00:33:10 +09:00
committed by Mikhail Glukhikh
parent 9cc93e9e55
commit 4abcd9a053
3 changed files with 18 additions and 1 deletions
@@ -310,7 +310,10 @@ fun KtModifierListOwner.canBeProtected(): Boolean {
}
}
fun KtModifierListOwner.canBeInternal(): Boolean = !isAnnotationClassPrimaryConstructor()
fun KtModifierListOwner.canBeInternal(): Boolean {
if (containingClass()?.isInterface() == true && hasJvmFieldAnnotation()) return false
return !isAnnotationClassPrimaryConstructor()
}
private fun KtModifierListOwner.isAnnotationClassPrimaryConstructor(): Boolean =
this is KtPrimaryConstructor && (this.parent as? KtClass)?.hasModifier(KtTokens.ANNOTATION_KEYWORD) ?: false