[
https://issues.apache.org/jira/browse/LUCENE-9497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17188851#comment-17188851
]
Varun Thacker edited comment on LUCENE-9497 at 9/1/20, 11:17 PM:
-----------------------------------------------------------------
Here is the first warning withing lucene core that this tool found
{code:java}
/Users/vthacker/apache-work/lucene-solr/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java:130:
warning: [IntLongMath] Expression of type int may overflow before being
assigned to a long
return maxDoc - minDoc;
^
(see https://errorprone.info/bugpattern/IntLongMath)
Did you mean 'return (long) maxDoc - minDoc;'?
error: warnings found and -Werror specified
1 error
1 warning
{code}
EDIT: If I suppress that warning ( since it looks like safe usage ) here is
the next warning
{code:java}
> Task :lucene:core:compileJava FAILED
/Users/vthacker/apache-work/lucene-solr/lucene/core/src/java/org/apache/lucene/search/Sort.java:180:
warning: [ReferenceEquality] Comparison using reference equality instead of
value equality
if (fields[i] != rewrittenSortFields[i]) {
^
(see https://errorprone.info/bugpattern/ReferenceEquality)
Did you mean 'if (!Objects.equals(fields[i], rewrittenSortFields[i])) {' or
'if (!fields[i].equals(rewrittenSortFields[i])) {'?
/Users/vthacker/apache-work/lucene-solr/lucene/core/src/java/org/apache/lucene/search/Sort.java:185:
warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary;
it is unlikely the code will be misinterpreted without them
return (changed) ? new Sort(rewrittenSortFields) : this;
^
(see https://errorprone.info/bugpattern/UnnecessaryParentheses)
Did you mean 'return changed ? new Sort(rewrittenSortFields) : this;'?
error: warnings found and -Werror specified
1 error
2 warnings
{code}
was (Author: varunthacker):
Here is the first warning withing lucene core that this tool found
{code:java}
/Users/vthacker/apache-work/lucene-solr/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java:130:
warning: [IntLongMath] Expression of type int may overflow before being
assigned to a long
return maxDoc - minDoc;
^
(see https://errorprone.info/bugpattern/IntLongMath)
Did you mean 'return (long) maxDoc - minDoc;'?
error: warnings found and -Werror specified
1 error
1 warning
{code}
> Integerate Error Prone ( Static Analysis Tool ) during compilation
> ------------------------------------------------------------------
>
> Key: LUCENE-9497
> URL: https://issues.apache.org/jira/browse/LUCENE-9497
> Project: Lucene - Core
> Issue Type: Task
> Reporter: Varun Thacker
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Integrate [https://github.com/google/error-prone] during compilation of our
> source code to catch mistakes
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]