Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with cobertura instrumentation #126

Closed
Nodens2k opened this issue Sep 1, 2015 · 2 comments
Closed

Conflict with cobertura instrumentation #126

Nodens2k opened this issue Sep 1, 2015 · 2 comments

Comments

@Nodens2k
Copy link

Nodens2k commented Sep 1, 2015

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)```

@jqno
Copy link
Owner

jqno commented Sep 1, 2015

Hi, thanks for reporting this!

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.

@jqno
Copy link
Owner

jqno commented Jan 24, 2016

Probably a duplicate of #132, and should be fixed in version 1.7.7. If not, feel free to re-open this issue.

@jqno jqno closed this as completed Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants