diff --git a/classlib/src/main/java/org/teavm/classlib/impl/record/ObjectMethodsSubstitutor.java b/classlib/src/main/java/org/teavm/classlib/impl/record/ObjectMethodsSubstitutor.java index ac2036785..8b3b7b571 100644 --- a/classlib/src/main/java/org/teavm/classlib/impl/record/ObjectMethodsSubstitutor.java +++ b/classlib/src/main/java/org/teavm/classlib/impl/record/ObjectMethodsSubstitutor.java @@ -54,7 +54,7 @@ public class ObjectMethodsSubstitutor implements BootstrapMethodSubstitutor { pe.constant(1).propagateTo(result); pe.jump(joint); }); - ConditionProducer classCondition = () -> thisVar.isNull() + ConditionProducer classCondition = () -> thatVar.isNull() .or(() -> thatVar.invokeVirtual("getClass", Class.class).isNotSame(pe.constant(type))); pe.when(classCondition).thenDo(() -> { pe.constant(0).propagateTo(result); diff --git a/tests/src/test/java/org/teavm/vm/RecordTest.java b/tests/src/test/java/org/teavm/vm/RecordTest.java index 27993501c..b310a59b7 100644 --- a/tests/src/test/java/org/teavm/vm/RecordTest.java +++ b/tests/src/test/java/org/teavm/vm/RecordTest.java @@ -16,6 +16,7 @@ package org.teavm.vm; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -26,6 +27,7 @@ import org.teavm.junit.TeaVMTestRunner; public class RecordTest { @Test public void equalsMethod() { + assertFalse(new A(2, "q").equals(null)); assertEquals(new A(2, "q"), new A(2, "q")); assertNotEquals(new A(2, "q"), new A(3, "q")); assertNotEquals(new A(2, "q"), new A(2, "w"));