Kotlin S1144 unused - false positive for "private" methods with annotations

Hello,

Private methods annotated with javax annotations (like javax.annotation.PostConstruct) raise unused private method issues (kotlin:S1144), however they are in fact used by the framework and should be ignored.

Similar Java rule handles this case correctly by checking for annotations.

Example:

@javax.annotation.PostConstruct
private fun init() {
    //Some init stuff
}

Sonarqube version 8.8, but I believe it affects all versions of this rule.

Hello @pkucia,

Thanks for the report. I’ve created a ticket for this issue.

Regards,
Margarita

1 Like

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