Sealed sub-class -> object: handle equals, suggest "add equals"

Before this commit, sealed sub-class without state was considered
a style issue.
After this commit, sealed sub-class without state AND custom equals
is considered a probable bug,
because comparison of its instances is very fragile.
Alternative fix (generate equals & hashCode by identity) is added.
This commit is contained in:
Mikhail Glukhikh
2018-06-13 18:05:46 +03:00
parent ecd2709a11
commit 9ef89447b3
27 changed files with 222 additions and 51 deletions
@@ -1,5 +1,5 @@
{
"mainFile": "Seal.kt",
"inspectionClass": "org.jetbrains.kotlin.idea.inspections.CanSealedSubClassBeObjectInspection",
"fix": "Convert Sealed Sub-class to Object"
"fix": "Convert sealed sub-class to object"
}
@@ -1,5 +1,5 @@
{
"mainFile": "Seal.kt",
"inspectionClass": "org.jetbrains.kotlin.idea.inspections.CanSealedSubClassBeObjectInspection",
"fix": "Convert Sealed Sub-class to Object"
"fix": "Convert sealed sub-class to object"
}