io.gitlab.arturbosch.detekt.rules.KtModifierList.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-psi-utils Show documentation
Show all versions of detekt-psi-utils Show documentation
Static code analysis for Kotlin
@file:Suppress("TooManyFunctions")
package io.gitlab.arturbosch.detekt.rules
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.KtModifierListOwner
import org.jetbrains.kotlin.psi.psiUtil.isPublic
fun KtModifierListOwner.isPublicNotOverridden() =
isPublicNotOverridden(false)
fun KtModifierListOwner.isPublicNotOverridden(considerProtectedAsPublic: Boolean) =
if (considerProtectedAsPublic) {
isPublic || isProtected()
} else {
isPublic
} && !isOverride()
fun KtModifierListOwner.isAbstract() = hasModifier(KtTokens.ABSTRACT_KEYWORD)
fun KtModifierListOwner.isOverride() = hasModifier(KtTokens.OVERRIDE_KEYWORD)
fun KtModifierListOwner.isOpen() = hasModifier(KtTokens.OPEN_KEYWORD)
fun KtModifierListOwner.isExternal() = hasModifier(KtTokens.EXTERNAL_KEYWORD)
fun KtModifierListOwner.isOperator() = hasModifier(KtTokens.OPERATOR_KEYWORD)
fun KtModifierListOwner.isConstant() = hasModifier(KtTokens.CONST_KEYWORD)
fun KtModifierListOwner.isInternal() = hasModifier(KtTokens.INTERNAL_KEYWORD)
fun KtModifierListOwner.isLateinit() = hasModifier(KtTokens.LATEINIT_KEYWORD)
fun KtModifierListOwner.isInline() = hasModifier(KtTokens.INLINE_KEYWORD)
fun KtModifierListOwner.isExpect() = hasModifier(KtTokens.EXPECT_KEYWORD)
fun KtModifierListOwner.isActual() = hasModifier(KtTokens.ACTUAL_KEYWORD)
fun KtModifierListOwner.isProtected() = hasModifier(KtTokens.PROTECTED_KEYWORD)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy