You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Robert Muir (Jira)" <ji...@apache.org> on 2021/03/22 03:44:00 UTC

[jira] [Commented] (LUCENE-9856) Improve static analysis to catch dead code and other potential bugs

    [ https://issues.apache.org/jira/browse/LUCENE-9856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17305873#comment-17305873 ] 

Robert Muir commented on LUCENE-9856:
-------------------------------------

We can turn it on in ecjLint with a one-line change, so it fails at precommit in the facets module:

{noformat}
> Task :lucene:facet:ecjLintMain
----------
1. ERROR in /home/rmuir/workspace/lucene/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java (at line 221)
        int doc;
            ^^^
The value of the local variable doc is not used
----------
2. ERROR in /home/rmuir/workspace/lucene/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java (at line 258)
        int doc;
            ^^^
The value of the local variable doc is not used
----------
----------
3. ERROR in /home/rmuir/workspace/lucene/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java (at line 447)
        int start;
            ^^^^^
The value of the local variable start is not used
----------
{noformat}

The problem is, there are failures in multiple lucene modules. So we need to fix these or add appropriate {{SuppressWarnings}} to defer them?, so that we can engage the check and at least prevent new stuff from coming in.

> Improve static analysis to catch dead code and other potential bugs
> -------------------------------------------------------------------
>
>                 Key: LUCENE-9856
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9856
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: general/build
>            Reporter: Zach Chen
>            Priority: Minor
>              Labels: build
>
> When working on PR [https://github.com/apache/lucene/pull/25,] we noticed that some dead code is not being caught during static analysis in gradle build, such as the *start* variable in the following code: [https://github.com/apache/lucene/blob/a5996dbecd4a6b4147d961260711a2cb6aeab3d3/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java#L446-L456] 
> We may need to look at if additional javac compiler flag, or configuration for *error prone,* should be added to catch such bug as well as other potential ones.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org