Closed illarionov closed 11 months ago
Hello @illarionov!
Thanks for reporting, but I'm not sure. whether there is a error
However, you can use @Suppress
annotation, to ignore this rule, if you want to use this variable directly with this name
companion object {
@Suppress("CONSTANT_UPPERCASE")
private const val serialVersionUID: Long = -1
}
This is a feature request, actually.
`serialVersionUID" this is the field name that cannot be changed when implementing the Serializable interface.
Adding Suppress annotation to every field impair readability.
Good point actually. This can be harcoded easily in naming rule. This is a good corner case, may be can be reflected in our guide https://github.com/saveourtool/diktat/blob/master/info/guide/diktat-coding-convention.md
Hello @illarionov!
Thanks for reporting, but I'm not sure. whether there is a error
However, you can use
@Suppress
annotation, to ignore this rule, if you want to use this variable directly with this namecompanion object { @Suppress("CONSTANT_UPPERCASE") private const val serialVersionUID: Long = -1 }
the same can be done by @get:JvmName("serialVersionUID")
, but yes, it looks ugly and not user friendly
Describe the bug
This code:
triggers the error:
Expected behavior
serialVersionUID should be ignored
Environment information