mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IDEA-349976: Do not get identifier for a special FqName in KotlinObjectExtensionRegistrationInspection
GitOrigin-RevId: ca001cf27ab55b934c302571bee667a3e745061a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8bd8afe907
commit
416104d230
@@ -43,11 +43,18 @@ internal class KotlinObjectExtensionRegistrationInspection : DevKitPluginXmlInsp
|
||||
val className = stringValue
|
||||
if (className.isNullOrBlank()) return false
|
||||
val normalizedClassName = ExtensionUtil.getNormalizedClassName(className) ?: return false
|
||||
val fqName = FqName(normalizedClassName).takeIf { it.shortName().identifier.isNotEmpty() } ?: return false
|
||||
val fqName = FqName(normalizedClassName).takeIf { it.isValidIdentifier() } ?: return false
|
||||
val kotlinAsJavaSupport = project.getService(KotlinAsJavaSupport::class.java) ?: return false
|
||||
val classOrObjectDeclarations = kotlinAsJavaSupport.findClassOrObjectDeclarations(fqName, this.resolveScope)
|
||||
return classOrObjectDeclarations.size == 1 && classOrObjectDeclarations.firstOrNull() is KtObjectDeclaration
|
||||
}
|
||||
|
||||
private fun FqName.isValidIdentifier(): Boolean {
|
||||
return this.shortName()
|
||||
.takeIf { !it.isSpecial } // IDEA-349976
|
||||
?.identifier
|
||||
?.isNotEmpty() == true
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
Reference in New Issue
Block a user