You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Jan,
I saw you just released version 1.7. Immediately gave it a spin and found that
a number of our tests started failing. The following is a minimal reproduction
case of the issue:
===========================================================================
package com.example;
import java.util.Comparator;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.testng.annotations.Test;
public final class RegressionTest {
static final class ProblematicClass {
private static final Comparator<ProblematicClass> COMPARATOR = Comparator.comparing(o -> 0);
@Override
public boolean equals(final Object other) {
return other instanceof ProblematicClass;
}
@Override
public int hashCode() {
return 0;
}
}
@Test(groups = "unit")
public void testEqualsAndHashCodeContract() {
EqualsVerifier.forClass(ProblematicClass.class).verify();
}
}
===========================================================================
This is the stacktrace:
java.lang.AssertionError: java.lang.NoClassDefFoundError:
java/util/Comparator$$Lambda$8/433874882
For more information, go to: http://www.jqno.nl/equalsverifier/errormessages
at nl.jqno.equalsverifier.EqualsVerifier.handleError(EqualsVerifier.java:414)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:400)
at com.example.RegressionTest.testEqualsAndHashCodeContract(RegressionTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.NoClassDefFoundError:
java/util/Comparator$$Lambda$8/433874882
at sun.reflect.GeneratedSerializationConstructorAccessor12.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at nl.jqno.equalsverifier.internal.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:45)
at nl.jqno.equalsverifier.internal.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
at nl.jqno.equalsverifier.util.Instantiator.instantiate(Instantiator.java:71)
at nl.jqno.equalsverifier.util.ObjectAccessor.copy(ObjectAccessor.java:94)
at nl.jqno.equalsverifier.FieldsChecker$ReflexivityFieldCheck.checkValueReflexivity(FieldsChecker.java:297)
at nl.jqno.equalsverifier.FieldsChecker$ReflexivityFieldCheck.execute(FieldsChecker.java:279)
at nl.jqno.equalsverifier.FieldInspector.check(FieldInspector.java:37)
at nl.jqno.equalsverifier.FieldsChecker.check(FieldsChecker.java:62)
at nl.jqno.equalsverifier.EqualsVerifier.verifyWithExamples(EqualsVerifier.java:460)
at nl.jqno.equalsverifier.EqualsVerifier.performVerification(EqualsVerifier.java:427)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:394)
... 25 more
Original issue reported on code.google.com by [email protected] on 4 Mar 2015 at 7:33
The text was updated successfully, but these errors were encountered:
Hi Stephan,
Nice catch. The Comparator object was actually a lambda object. EqualsVerifier
tried to clone it, but was unable to because it's actually a synthetic class.
Anyway, I just released a fix in version 1.7.1.
Original issue reported on code.google.com by
[email protected]
on 4 Mar 2015 at 7:33The text was updated successfully, but these errors were encountered: