squid:S1319 forced on @Override method arguments


(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 {
  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:

(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