squid:S1319 forced on @Override method arguments

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

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

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.