A false negative about the rule RSPEC-3306

Hi, I found a false negative about the rule RSPEC-3306. Please see the code example below.

The first sample used the annotation @com.google.inject.Inject, and the second one uses @javax.inject.Inject. The analysis results of the two cases should be equivalent because these two annotations are equivalent. However, SonarQube reports a warning in the second sample and no warnings in the first one.

Actually, it should report a warning in Test1 like Test2 because Test1 is a class with non-private constructors use field injection. Hence, I think this is a false negative.

class Test1 {
   @com.google.inject.Inject
   Object injectedField; // report no warning
}

class Test2 {
   @javax.inject.Inject
   Object injectedField; // report a warning
}

Hey there.

Thanks for the report – it was also reported recently and a ticket already made.