java:S1168 does not respect jakarta changes and has undocumented behavior

Using sonarqube latest 9.7.1

Running rule produces the following error:
Return an empty map instead of null.

  @Nullable
  protected Map<String, Object> getData() {
    ...
    return null;
  }

Previsously with the import javax.annotation.Nullable everything was fine, now with the changed import jakarta.annotation.Nullable the issue pops up.
Looks like the adaption to the jakarta migration is missing here.

Also the previous behavior is not documented as compliant in the rule description.

Kind regards,
Michael

Thanks for reporting this false-positive!

Since all the necessary information has been included, we’ve flagged this for attention by an expert. This means that somebody will look at your report, maybe ask some follow-up questions, and try and determine if it’s really a false-positive that should be fixed.

This review could be done hours, days, or even weeks from now. If it takes a while – it doesn’t mean your report isn’t important to us, it just means that our teams are already hard-at-work developing new language analysis features, and your report is in the queue.

If you’re using SonarQube or SonarCloud – an issue administrator can always mark an issue as a false-positive in the UI (this also suppresses it in SonarLint when using Connected Mode). The rule can also be disabled in your Quality Profile if it’s particularly noisy.

Hi Michael, thank you for the feedback.
We are aware of the Jakarta migration and we opened a ticket to find out which rules are impacted, and your feedback is really helpful in that sense!
I’ve just added this rule to the list of impacted ones, and marked it as reported by the community, so that maybe we will be able to handle it sooner!

Have a nice day :slight_smile: