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
I have tried to run a cobertura check from maven on a simple Java 7 project. The command was:
mvn clean package cobertura:cobertura
The testsuite passes with no failures or errors during the "package" execution, but the second round, with cobertura instrumentation on, fails on several validations with the following message:
Transient field __cobertura_counters should not be included in equals/hashCode contract.(..)
This would be the relevant stacktrace:
java.lang.AssertionError: Transient field __cobertura_counters should not be included in equals/hashCode contract.
For more information, go to: http://www.jqno.nl/equalsverifier/errormessages
at nl.jqno.equalsverifier.EqualsVerifier.handleError(EqualsVerifier.java:406)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:389)```
The text was updated successfully, but these errors were encountered:
Unfortunately, I'm not able to reproduce this. I've run Cobertura on EqualsVerifier's own test suite, which includes many different kinds of calls to EqualsVerifier, and that seems to run fine. With the default configuration, I get some warnings, but nothing like the error you describe.
It looks like Cobertura generates a field in your class. That's not surprising; Jacoco does this as well. But for some reason EqualsVerifier treats it like a regular field, instead of a generated one. Usually these fields are marked "synthetic" in the bytecode, but maybe this one isn't.
Anyway, you could always try to suppress Warning.TRANSIENT_FIELDS. If that doesn't work, then could you send me a small project that reproduces this error? Ideally, that would be just the pom (or build script for whatever build tool you use), a class, and a test that contains a call to EqualsVerifier, but whatever else you need to reproduce it, is fine of course. Without that, I probably won't be able to help you.
I have tried to run a cobertura check from maven on a simple Java 7 project. The command was:
mvn clean package cobertura:cobertura
The testsuite passes with no failures or errors during the "package" execution, but the second round, with cobertura instrumentation on, fails on several validations with the following message:
Transient field __cobertura_counters should not be included in equals/hashCode contract.(..)
This would be the relevant stacktrace:
The text was updated successfully, but these errors were encountered: