RSPEC-1172 - unused parameter not working with @Path in a method

  • What language is this for?
    Java

  • Which rule?
    RSPEC-1172 Unused method parameters should be removed

  • Why do you believe it’s a false-negative?

The following code triggers the rule:

public int method(int a, int b) {
    return a+1;
}

but if you add an javax.ws.rs.Path annotation, the method pass without any issue:

import javax.ws.rs.Path;

@Path("text")
public int method(int a, int b) {
    return a+1;
}
  • Are you using
    • SonarCloud

Hi,

Welcome to the community and thanks for this report!

Where are you seeing this? SonarCloud? Or SonarQube / SonarLint? And if either of the latter two, which version?

 
Thx,
Ann

SonarCloud. The problem also appears in Eclipse with SonarLint for Eclipse 7.4.0.46482.

1 Like