Generate equals()/hashCode(): Forbid in interfaces
#KT-10815 Fixed
This commit is contained in:
+4
-1
@@ -69,7 +69,10 @@ class KotlinGenerateEqualsAndHashcodeAction : KotlinGenerateMemberActionBase<Kot
|
|||||||
)
|
)
|
||||||
|
|
||||||
override fun isValidForClass(targetClass: KtClassOrObject): Boolean {
|
override fun isValidForClass(targetClass: KtClassOrObject): Boolean {
|
||||||
return targetClass is KtClass && targetClass !is KtEnumEntry && !targetClass.isAnnotation()
|
return targetClass is KtClass
|
||||||
|
&& targetClass !is KtEnumEntry
|
||||||
|
&& !targetClass.isAnnotation()
|
||||||
|
&& !targetClass.isInterface()
|
||||||
&& !targetClass.hasModifier(KtTokens.DATA_KEYWORD)
|
&& !targetClass.hasModifier(KtTokens.DATA_KEYWORD)
|
||||||
&& getPropertiesToUseInGeneratedMember(targetClass).isNotEmpty()
|
&& getPropertiesToUseInGeneratedMember(targetClass).isNotEmpty()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
// NOT_APPLICABLE
|
// NOT_APPLICABLE
|
||||||
interface A {<caret>
|
interface A {<caret>
|
||||||
fun foo() {
|
val foo: Int
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user