Files
kotlin-fork/compiler/testData/codegen/box/javaInterop/abstractMethodsOfAny.kt
T
Alexander Udalov daac8603d0 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
2023-11-24 14:48:10 +00:00

64 lines
1.2 KiB
Kotlin
Vendored

// 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"
}