-
Notifications
You must be signed in to change notification settings - Fork 746
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
UnusedMethod is reported for JUnit @BeforeEach and for Java validation annotated methods #2881
Comments
Both of those checks have heuristics with lists of annotations they recognize as meaning the variable or method isn't actually unused:
I'm happy to take PRs adding annotations to those lists. Also FYI the next release of Error Prone will have a |
The problem observed with error-prone 2.10.0
The problem is reported for methods with well-known annotations like
org.junit.jupiter.api.BeforeEach
,javax.validation.constraints.AssertTrue
andcom.fasterxml.jackson.annotation.JsonProperty
The reported methods are indeed not used directly by our code, but by a dependency, like JUnit 5 or Jackson. It seems crude to annotate every such method with
@SuppressWarnings("UnusedMethod")
There is a similar problem with "Unused variable" reported for class members annotated with
org.springframework.boot.test.mock.mockito.MockBean
.The text was updated successfully, but these errors were encountered: