False positive for S6212 with generic return type

  • Sonarlint 5.9.0.3144

Have a method with a generic return type

<T> T get(HGHandle handle);

And a method calling it:

Slot slot = graph.get(slotHandle);

which triggers S6212 but changing the type to var won’t compile since now the type is resolved to Object and we can’t call any other Slot specific method afterwards, w/o maybe casting, which surely defeats the purpose of the rule.

Hello @Alain_Picard,

We already have a ticket for this case: https://jira.sonarsource.com/browse/SONARJAVA-3839. Will be fixed soon.

Regards,
Margarita

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