Provide equals/hashCode for Kotlin light classes

KotlinLightClassForExplicitDeclaration already had equals/hashCode, but the
other three implementations of KotlinLightClass did not; this resulted in type
mismatch errors in Java code where the signatures of a super method and the
corresponding sub method wouldn't match because types of parameters were
different

 #KT-8543 Fixed
This commit is contained in:
Alexander Udalov
2015-07-21 17:50:26 +03:00
parent 4af0ed822f
commit 74ed3b9562
4 changed files with 101 additions and 2 deletions
@@ -95,4 +95,17 @@ public class FakeLightClassForFileOfPackage extends AbstractLightClass implement
public Language getLanguage() {
return JetLanguage.INSTANCE;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof FakeLightClassForFileOfPackage)) return false;
FakeLightClassForFileOfPackage other = (FakeLightClassForFileOfPackage) obj;
return file == other.file && delegate.equals(other.delegate);
}
@Override
public int hashCode() {
return file.hashCode() * 31 + delegate.hashCode();
}
}
@@ -202,4 +202,10 @@ public abstract class KotlinWrappingLightClass extends AbstractLightClass implem
public ItemPresentation getPresentation() {
return ItemPresentationProviders.getItemPresentation(this);
}
@Override
public abstract boolean equals(Object obj);
@Override
public abstract int hashCode();
}