squid:S1319 forced on @Override method arguments

java

(Peter Butkovic) #1

Sonarqube version: 6.7.1
language: java

Violation: The type of the "env" object should be an interface such as "Map" rather than the implementation "Hashtable". (squid:S1319) is reported on the following code:

public class P6DataSourceFactory implements ObjectFactory {
  @Override
  public Object getObjectInstance(Object refObj,
                                  Name nm,
                                  Context ctx,
                                  Hashtable<?,?> env) throws Exception {

The problem is however that the parent class in the Java API uses the same declaration. Changing the last argument to Map ends in the compilation error.

False positive:
https://sonarcloud.io/project/issues?id=p6spy%3Ap6spy&pullRequest=447&issues=AWYxvFc0_XXc3YMr_yTe&open=AWYxvFc0_XXc3YMr_yTe


(Nicolas Peru) #2

That is indeed an FP : ticket created to handle the issue, thanks for reporting it. https://jira.sonarsource.com/browse/SONARJAVA-2919