Override JSpecify nullable raise java:S2638

Package is by default NullMarkes when I override a Nullable methode

e.g. Super class from spring

protected @Nullable ResponseEntity<Object> handleExceptionInternal(..)

override

   @Override
   protected @Nullable ResponseEntity<Object> handleExceptionInternal(
         final Exception ex,
         @Nullable final Object body,
         final HttpHeaders headers,
         final HttpStatusCode statusCode,
         final WebRequest request ) {
      ...
      return super.handleExceptionInternal( ex, body, headers, statusCode, request );
   }

If I remove Nullable or not have no effect: I get always “Fix the incompatbility of the annotation Nullable to honor NullMarked at package level od the overridden method”

Hi @MelleD,

Thank you for your report!

I was able to reproduce the false positive: the rule flags the Object type argument because it incorrectly treats it as @Nullable due to the annotation on the return type ResponseEntity<Object>.

I have created a ticket to fix it in the analyzer: SONARJAVA-6714

Thanks again for taking the time to write this post and help us improve the rule.

Best,

Noémie