java:S107 doesn’t support API annotations jakarta.ws.rs.GET

In sonarqube version 10.2 the rule does not make an exception for jakarta.ws.rs API annotations (like jakarta.ws.rs.GET).
In our case, rule “Method has 8 parameters, which is greater than 7 authorized” should be ignored.

public class ExampleRestController {

    private final UseCaseExample useCaseExample;

    public ExampleRestController() {
        this.useCaseExample = new UseCaseExampleImpl(new ExampleJdbcRepository());
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @JacksonFeatures(serializationEnable = { SerializationFeature.INDENT_OUTPUT })
    public List<ExampleWebModel> getInventory(
            @QueryParam("Param1") String param1,
            @QueryParam("Param2") String param2,
            @QueryParam("Param3") String param3,
            @QueryParam("Param4") Boolean param4,
            @QueryParam("Param5") String param5,
            @QueryParam("Param6") String param6,
            @QueryParam("Param7") String param7,
            @QueryParam("Param8") String param8) {
        List<InventoryPolicy> inventory = useCaseExample.getInventory(
                new InventoryParameters(
                        param1,
                        param2,
                        param3,
                        param4,
                        param5,
                        param6,
                        param7,
                        param8
                )
        );

        return ExampleWebModel.transform(inventory);
    }
}
1 Like

Hi Khrystyna, thanks for the report!
Indeed the rule makes an exception for javax annotations but not for jakarta ones. We have an ongoing effort to support the migration between the two namespaces. I will add this rule that we missed to it, so it won’t take long to have it fixed.

You can track progress on it here

Have a nice day!