mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
KTIJ-31157 [kotlin] Always add isEmpty properties in K2 implementation of NotPropertiesServiceImpl
We exclude `isEmpty` until KT-72305 is fixed and it is supposed to be the default behaviour Hence, we should not ever store it to the settings or allow users to modify or remove it, because it should be transparent to the users (cherry picked from commit fbe5dc2f3aa748d780e98bb038629fe5e20b7922) IJ-CR-146866 GitOrigin-RevId: ae6f5f100f94782958c29a8d6c7ef495072fafd2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
58e5dc7d41
commit
bf429db3b9
@@ -646,10 +646,7 @@ class UsePropertyAccessSyntaxInspection : LocalInspectionTool(), CleanupLocalIns
|
||||
) KotlinBundle.message("use.of.setter.method.instead.of.property.access.syntax")
|
||||
else KotlinBundle.message("use.of.getter.method.instead.of.property.access.syntax")
|
||||
|
||||
val propertiesNotToReplace =
|
||||
(NotPropertiesService.DEFAULT.map(::FqNameUnsafe)
|
||||
+ FqNameUnsafe("java.util.AbstractCollection.isEmpty") // KTIJ-31157
|
||||
+ FqNameUnsafe("java.util.AbstractMap.isEmpty")).toMutableSet() // KTIJ-31157
|
||||
val propertiesNotToReplace = NotPropertiesService.DEFAULT.map(::FqNameUnsafe).toMutableSet()
|
||||
|
||||
// Serialized setting
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
@@ -695,16 +692,22 @@ class NotPropertiesServiceImpl(private val project: Project) : NotPropertiesServ
|
||||
override fun getNotProperties(element: PsiElement): Set<FqNameUnsafe> {
|
||||
val profile = InspectionProjectProfileManager.getInstance(project).currentProfile
|
||||
val tool = profile.getUnwrappedTool(USE_PROPERTY_ACCESS_INSPECTION, element)
|
||||
var propertiesNotToReplace = tool?.propertiesNotToReplace
|
||||
if (propertiesNotToReplace == null) {
|
||||
propertiesNotToReplace = NotPropertiesService.DEFAULT.map(::FqNameUnsafe).toMutableSet()
|
||||
propertiesNotToReplace.add(FqNameUnsafe("java.util.AbstractCollection.isEmpty")) // KTIJ-31157
|
||||
propertiesNotToReplace.add(FqNameUnsafe("java.util.AbstractMap.isEmpty")) // KTIJ-31157
|
||||
}
|
||||
return propertiesNotToReplace
|
||||
val notProperties = (tool?.propertiesNotToReplace ?: NotPropertiesService.DEFAULT.map(::FqNameUnsafe)).toSet()
|
||||
return notProperties + K2_EXTRA_NOT_PROPERTIES
|
||||
}
|
||||
|
||||
companion object {
|
||||
val USE_PROPERTY_ACCESS_INSPECTION: Key<UsePropertyAccessSyntaxInspection> = Key.create("UsePropertyAccessSyntax")
|
||||
|
||||
/**
|
||||
* Properties excluded due to different problems in K2 Mode.
|
||||
*
|
||||
* Intentionally not saved into [UsePropertyAccessSyntaxInspection.propertiesNotToReplace],
|
||||
* because they are not supposed to be possible to disable or modify.
|
||||
*/
|
||||
val K2_EXTRA_NOT_PROPERTIES: List<FqNameUnsafe> = listOf(
|
||||
"java.util.AbstractCollection.isEmpty", // KTIJ-31157, KT-72305
|
||||
"java.util.AbstractMap.isEmpty", // KTIJ-31157, KT-72305
|
||||
).map(::FqNameUnsafe)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user