java:S1948 FP when migrating to jakarta.inject.Inject

  • Java
  • Which rule?
    java:S1948
  • Why do you believe it’s a false-positive/false-negative?

When migrating from javax.inject.Inject to jakarta.inject.Inject the Rule suddenly raises FP for the affected fields.

The rule does not seem to check for jakarta.inject.Inject in any way, even though it did check for javax.inject.Inject.

  • Are you using
    • SonarQube - which version? 9.9.3
    • SonarLint - which IDE/version? IntelliJ 10.2.1.77304
      • in connected mode with SonarQube - yes
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
package mypackage;

import jakarta.inject.Inject;

public class MyClass implements Serializable {

	@Inject
	private MyService service;

}

Hey there.

Thanks for the report. We already have an open ticket here: SONARJAVA-4816

I opened a PR Add jakarta.inject.Inject to S1948 by renoth · Pull Request #4674 · SonarSource/sonar-java · GitHub