# announcements


11/28/2019, 7:05 PM
Hi all, today at work we found something curious and I want to ask if this is the intended behaviour: Suppose we have a sealed class with a property. Then we have a data class inheriting from this selaed class:
Copy code
sealed class TestClassParent(val any: Any) {
    data class TestClassChild(val anyOther: Any) : TestClassParent(Any())

When I decompile this super.equals() seems to be not called in the TestClassChild:

public boolean equals(@Nullable Object var1) {
         if (this != var1) {
            if (var1 instanceof TestClassParent.TestClassChild) {
               TestClassParent.TestClassChild var2 = (TestClassParent.TestClassChild)var1;
               if (Intrinsics.areEqual(this.anyOther, var2.anyOther)) {
                  return true;

            return false;
         } else {
            return true;

I don't know if you could construct a case where this matters, but at first glance it seems that the equals contract is broken


11/28/2019, 8:07 PM
The decompilation looks fine too me, since the super class
is not a
data class
. For non-data classes, the only requirement for equality is that both references 'point' to the same instance (
this == var1
in this snippet)