You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Ekaterina Dimitrova (Jira)" <ji...@apache.org> on 2023/05/31 15:04:00 UTC
[jira] [Comment Edited] (CASSANDRA-18239) Replace eclipse warnings based static code analysis with something better (Sonar)
[ https://issues.apache.org/jira/browse/CASSANDRA-18239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17728018#comment-17728018 ]
Ekaterina Dimitrova edited comment on CASSANDRA-18239 at 5/31/23 3:03 PM:
--------------------------------------------------------------------------
{quote}some draft for using error-prone in the build
{quote}
That looks good, but unfortunately, to take advantage of the [pattern|https://errorprone.info/bugpattern/MustBeClosedChecker] we are interested in to replace eclipse-warnings, we need to start adding @MustBeClosed for the methods that produce resources that must be closed.
I suspect this will regress quickly as we will be human-dependent; people will start forgetting to use the annotation.
So to summarize:
* SpotBugs is not ready for newer JDK versions
* ErrorProne would involve manual work, and it will be human dependent
* sonar was mentioned not to be an option for direct replacement of eclipse warnings
With that said, I should go back to CASSANDRA-18190 and review all the 100+ new warnings we have with eclipse-warnings after upgrading it for newer JDK versions...
was (Author: e.dimitrova):
{quote}some draft for using error-prone in the build
{quote}
That looks good, but unfortunately, to take advantage of the pattern we are interested in to replace eclipse-warnings, we need to start adding @MustBeClosed for the methods that produce resources that must be closed.
I suspect this will regress quickly as we will be human-dependent; people will start forgetting to use the annotation.
So to summarize:
* SpotBugs is not ready for newer JDK versions
* ErrorProne would involve manual work, and it will be human dependent
* sonar was mentioned not to be an option for direct replacement of eclipse warnings
With that said, I should go back to CASSANDRA-18190 and review all the 100+ new warnings we have with eclipse-warnings after upgrading it for newer JDK versions...
> Replace eclipse warnings based static code analysis with something better (Sonar)
> ---------------------------------------------------------------------------------
>
> Key: CASSANDRA-18239
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18239
> Project: Cassandra
> Issue Type: Task
> Components: Build
> Reporter: Jacek Lewandowski
> Priority: Normal
>
> Eclipse warnings is used for static code analysis. However, it does not fit well into Cassandra code and practically we end up explicitly adding suppressions in many places just to satisfy that tool rather than fix the real issues.
> This is an incomplete list of reasons to remove it:
> - not closed resources are detected incorrectly
> - does not recognize custom utility methods used to close the resources, which use use heavily in the code, like {{Throwables.close}}, {{FileUtils.close}}, {{closeQuietly}}...
> - because of the above, we cannot make important things like {{Ref}} to implement {{Closeable}} as it would make the tool to explode with tons of warnings
> - it complains about correct generics - something like "method X is not applicable for ..." when the code compiles successfully is not acceptable
> - it is old and not maintained
> There are better tools like IntelliJ inspections for example, which can also be run in headless mode
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org