gnodet commented on issue #238: URL: https://github.com/apache/maven-parent/issues/238#issuecomment-3410248620
> > `UnusedLocalVariable` are plain wrong imho > > convention tells them to be named accordingly like unused or ignored just like error-prone does. > > * https://maven.apache.org/ref/3.9.11/maven-core/xref/org/apache/maven/lifecycle/internal/MojoExecutor.html#L313 > > * `lock` is not used and not named conventionally as `unused` to avoid questions, so the analysis seems to be correct. > * https://errorprone.info/bugpattern/UnusedVariable In the first case, if the tool was able to see that this should not apply on override methods, that could eventually be useful, but having to rename variables to `unused` to please the tool is wrong imho. On the `lock`, that variable _is_ used, we need it because it's an auto-closable and calling it `unused` would be wrong imho. That rule predates the enhanced try/catch block and I think it should be avoided now. > `False positives on fields and parameters can be suppressed by prefixing the variable name with unused, e.g.:` > > > checkstyle > > check has no type awareness so [RedundantStringConversion](https://error-prone.picnic.tech/bugpatterns/RedundantStringConversion) for sure violating. I'm not saying we should not try to improve / fix our code (when there's actually something to improve). But maybe PMD is too old and there are better alternatives. What about SpotBugs ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
