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

URF_UNREAD_FIELD: should be ignored on test class fields annotated with JUnit5's @RegisterExtension #574

Closed
hanleyt opened this issue Feb 28, 2018 · 1 comment · Fixed by #2873

Comments

@hanleyt
Copy link

hanleyt commented Feb 28, 2018

JUnit 5.1 allows you to register an extension programmatically by adding a field to your class as shown below. Similiar to JUnit4s Rule/ClassRule.

@RegisterExtension
JerseyExtension jerseyExtension = new JerseyExtension(this::configureJersey);

(apologies I haven't yet had a chance to add a failing test for this)

@hanleyt hanleyt changed the title URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD: should be ignored on test class fields annotated with JUnit5's @RegisterExtension URF_UNREAD_FIELD: should be ignored on test class fields annotated with JUnit5's @RegisterExtension Feb 28, 2018
@ghost
Copy link

ghost commented Oct 30, 2018

I would prefer a configurable list of annotations that that tell SpotBugs to ignore this rule for a given field.
@xmlelement and @SerializedName also define that the field value is used. And in the past, I have already written my own tools that access fields via annotations.

This would be a great thing to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants