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:
+13
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user