Skip to content

UnusedMethod is reported for JUnit @BeforeEach and for Java validation annotated methods #2881

@sergeykad

Description

@sergeykad

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 and com.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions