- ALM used: GitHub
- CI system used: Jenkins
- Languages of the repository: Java/JS/TS
- Problem observed
There is no obvious way to fix java:S2638 when it’s already violated by the parent class not under our control - Steps to reproduce
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
public class ExceptionHandler extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException ex, HttpHeaders headers, HttpStatusCode status,
WebRequest request) {
return null;
}
}
The method triggers java:S2638 whenever
-
we leave it without nullability annotation
-
if we put
@Nullable -
if we put
@NonNull
The parent class from Spring6 overrode the package-global @NonNull by the @Nullable annotation on the method level.