mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
[kotlin] Do not apply naming conventions to serialVersionUID
#KTIJ-27913 Fixed GitOrigin-RevId: a2258ac45115255e6e88721ec49267865d95030f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
60c8096610
commit
2c056ddc9a
@@ -5,7 +5,8 @@ package org.jetbrains.kotlin.idea.codeInsight.inspections.shared
|
||||
import com.intellij.analysis.AnalysisScope
|
||||
import com.intellij.codeInspection.*
|
||||
import com.intellij.codeInspection.options.OptPane
|
||||
import com.intellij.codeInspection.options.OptPane.*
|
||||
import com.intellij.codeInspection.options.OptPane.pane
|
||||
import com.intellij.codeInspection.options.OptPane.string
|
||||
import com.intellij.codeInspection.options.OptionController
|
||||
import com.intellij.codeInspection.options.RegexValidator
|
||||
import com.intellij.codeInspection.reference.RefEntity
|
||||
@@ -261,7 +262,7 @@ abstract class PropertyNameInspectionBase protected constructor(
|
||||
override fun visitProperty(property: KtProperty) {
|
||||
if (property.hasModifier(KtTokens.OVERRIDE_KEYWORD)) return
|
||||
if (property.getKind() == kind) {
|
||||
verifyName(property, holder)
|
||||
verifyName(property, holder, additionalCheck = { additionalPropertyCheck(property) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +282,8 @@ abstract class PropertyNameInspectionBase protected constructor(
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun additionalPropertyCheck(property: KtNamedDeclaration): Boolean = true
|
||||
|
||||
private val PsiNamedElement.isSingleUnderscore: Boolean
|
||||
get() = name == "_"
|
||||
|
||||
@@ -349,6 +352,9 @@ class ConstPropertyNameInspection : PropertyNameInspectionBase(
|
||||
"[A-Z][_A-Z\\d]*"
|
||||
) {
|
||||
override fun getNamingRules(): Array<NamingRule> = arrayOf(NO_LOWER, NO_BAD_CHARACTERS)
|
||||
|
||||
override fun additionalPropertyCheck(property: KtNamedDeclaration): Boolean =
|
||||
property.name != "serialVersionUID"
|
||||
}
|
||||
|
||||
class LocalVariableNameInspection : PropertyNameInspectionBase(
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>14</line>
|
||||
<line>17</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt"/>
|
||||
<description>Const property name <code>lowerCase1</code> should not contain lowercase letters #loc</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>16</line>
|
||||
<line>19</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt"/>
|
||||
<description>Const property name <code>`BAD CHAR`</code> may contain only letters and digits #loc</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>26</line>
|
||||
<line>29</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt"/>
|
||||
<description>Const property name <code>lowerCase1</code> should not contain lowercase letters #loc</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>28</line>
|
||||
<line>31</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt"/>
|
||||
<description>Const property name <code>`BAD CHAR`</code> may contain only letters and digits #loc</description>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.io.Serializable
|
||||
|
||||
val justVal = ""
|
||||
|
||||
const val NO_WARNING: String = ""
|
||||
@@ -6,8 +8,9 @@ const val lowerCase1: String = ""
|
||||
|
||||
const val `BAD CHAR` = ""
|
||||
|
||||
class ContainerClass {
|
||||
class ContainerClass : Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = -78L
|
||||
|
||||
const val NO_WARNING: String = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user