Fir2Ir: build fake overrides for abstract methods from Any

This call to isAbstractMethodOfAny was in Fir2IrLazyClass since its
inception in 0622be14a5, and there's no explanation why this was
necessary. Removing it does not seem to break anything, but fixes the
case when IrFakeOverrideRebuilder is enabled and when Java base class
declares an abstract equals/hashCode/toString which is not overridden in
the Kotlin subclass.

 #KT-63443 Fixed
This commit is contained in:
Alexander Udalov
2023-11-24 12:43:37 +01:00
committed by Space Team
parent b63a780e15
commit daac8603d0
11 changed files with 116 additions and 7 deletions
@@ -0,0 +1,63 @@
// TARGET_BACKEND: JVM
// FILE: JI.java
public interface JI {
@Override
public abstract boolean equals(Object o);
@Override
public abstract int hashCode();
@Override
public abstract String toString();
}
// FILE: JC.java
public abstract class JC {
@Override
public abstract boolean equals(Object o);
@Override
public abstract int hashCode();
@Override
public abstract String toString();
}
// FILE: JC2.java
public abstract class JC2 extends JC {
}
// FILE: box.kt
interface KI : JI
class X : KI {
override fun equals(other: Any?): Boolean = true
override fun hashCode(): Int = 0
override fun toString(): String = ""
}
abstract class KC : JC()
class Y : KC() {
override fun equals(other: Any?): Boolean = true
override fun hashCode(): Int = 0
override fun toString(): String = ""
}
abstract class KC2 : JC2()
class Z : KC2() {
override fun equals(other: Any?): Boolean = true
override fun hashCode(): Int = 0
override fun toString(): String = ""
}
fun box(): String {
X().equals(X())
X().hashCode()
X().toString()
Y().equals(Y())
Y().hashCode()
Y().toString()
Z().equals(Z())
Z().hashCode()
Z().toString()
return "OK"
}