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

Static fields should not be considered unused fields #57

Closed
GoogleCodeExporter opened this issue Mar 29, 2015 · 4 comments
Closed

Static fields should not be considered unused fields #57

GoogleCodeExporter opened this issue Mar 29, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Hi Jan! The "allFieldsShouldBeUsed()" option is working well for me, but it 
looks like it also triggers for static fields.  Maybe the best way to fix this 
would be to add a check for the static modifier in addition to the check for 
transient?

What steps will reproduce the problem?
1. Use EqualsVerifier to verify the attached StaticFieldTestClass with the 
allFieldsShouldBeUsed() option set.

What is the expected output? What do you see instead?
Expected: This class should pass verification
Actual: Verification fails with "java.lang.AssertionError: Significant fields: 
equals does not use SOME_STATIC."

What version of the product are you using? On what operating system?
Version 1.1 on Linux/Windows



Original issue reported on code.google.com by [email protected] on 26 Mar 2012 at 2:06

Attachments:

@GoogleCodeExporter
Copy link
Author

Hi Kevin,

Sorry for the late response; apparently my issues-feed got broken, and I only 
discovered your issue just now.

I agree, static fields should probably not be included in the 
'allFieldsShouldBeUsed' check. I'll do something about it in the next release. 
As usual though, I can't promise when that will be :).


Jan

Original comment by [email protected] on 4 Apr 2012 at 3:04

  • Changed state: Accepted
  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

This package was recommended to me by the crowd at StackOverflow 
(http://stackoverflow.com/questions/7704038/what-are-ways-to-keep-hashcode-equal
s-consistent-with-the-business-definition-of).  My use case is all about being 
able to use allFieldsShouldBeUsed, but many if not most of my classes have 
static fields including the Serializable standard serialVersionUID.  Be great 
to have this implemented!

Original comment by [email protected] on 15 Apr 2012 at 6:06

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Hi Sharakan,

Thanks for your comment; nice to see people recommend EqualsVerifier :). I have 
some spare time coming up, so I'll try to push out a new release soon!

Jan

Original comment by [email protected] on 15 Apr 2012 at 10:01

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Hi Kevin and Sharakan,

I just released version 1.1.3, which solves this issue.

Regards,
Jan

Original comment by [email protected] on 21 Apr 2012 at 1:29

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

jqno pushed a commit that referenced this issue Aug 23, 2016
Update "read up here" link.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant