Java:S1854 MapStruct AfterMapping FP

What language is this for? Java
Which rule? Java:S1854
Why do you believe it’s a false-positive/false-negative?
Because I’m using the variable. If its TP, please tell me why the code is wrong and how to fix it.

Are you using

  • SonarQube - * Enterprise Edition Version 10.3 (build 82913)

  • How can we reproduce the problem? Give us a self-contained snippet of code
    (formatted text, no screenshots)

    default void setChangesIntoMappedClass(
            @MappingTarget ClassToCreate.ClassToCreateBuilder mapped,
            Request request) {

        ModifiedDataReturned transformed = transform(request.getNumber()); // this line raise the error "Remove this useless assignment to local variable "transformed"."



I can try to get a more detailed code later if this is a FP. The problem happen in a Java interface used by MapStruct and we still use Spring Boot, Lombok and statics methods.
Sorry for any language mistakes; English is not my native tongue.

I tried to find similiar errors but found about lambdas or something and most of the cases was closed.