Unused parameters in abstract constructor

(Ewa Śliwińska) #1

I just spent some time on the stupid error in this code:

/** Each created chart needs to have labels.
 * @param labels
 *           legend labels
 * @param title
 *           chart title */
Chart( final List<String> labels, final String title )
   this.labels = labels;

I could be warned about it with Sonar, but (I also spent some time on investigating this) there is an exception in Unused method parameters should be removed rule: in overridable methods (non-final, or not member of a final class, non-static, non-private), if the parameter is documented with a proper javadoc - it is my case.

I wonder if anything could be done to prevent such behaviour - maybe an exception from this exception? :wink:

To be honest, I don’t fully understand why is it there - I only know that in my case it was no good, and I was disappointed with Sonar (of course the bug is mine, but that’s why I have Sonar).