You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/11/11 17:28:03 UTC

[GitHub] [lucene] risdenk opened a new pull request, #11921: errorprone WIP

risdenk opened a new pull request, #11921:
URL: https://github.com/apache/lucene/pull/11921

   ### Description
   
   <!--
   If this is your first contribution to Lucene, please make sure you have reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] risdenk commented on pull request #11921: errorprone WIP

Posted by GitBox <gi...@apache.org>.
risdenk commented on PR #11921:
URL: https://github.com/apache/lucene/pull/11921#issuecomment-1311974711

   I have not looked at fixing anything just showing its possible to run this without failing and get all the findings at once. FYI @rmuir 


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] risdenk closed pull request #11921: errorprone WIP

Posted by GitBox <gi...@apache.org>.
risdenk closed pull request #11921: errorprone WIP
URL: https://github.com/apache/lucene/pull/11921


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] rmuir commented on pull request #11921: errorprone WIP

Posted by GitBox <gi...@apache.org>.
rmuir commented on PR #11921:
URL: https://github.com/apache/lucene/pull/11921#issuecomment-1312000223

   Yeah I would have never got thru the issues the old way i was trying to do it. Now i can just do:
   `/gradlew assemble -Pvalidation.errorprone=true -Pjavac.failOnWarnings=false > ~/overflow.log 2>&1` and review the file afterwards.
   
   I'm not trying the IntLongMath one yet, fear it may be too noisy. Just some more targeted checks and I'm trying to work thru all the issues, as some of these honestly look like potential real issues.


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] risdenk commented on pull request #11921: errorprone WIP

Posted by GitBox <gi...@apache.org>.
risdenk commented on PR #11921:
URL: https://github.com/apache/lucene/pull/11921#issuecomment-1311978301

   Output from run enabling `IntLogMath` rule:
   
   ```
   ➜  lucene git:(github-11910) ./gradlew check -x test -Pvalidation.errorprone=true -Pjavac.failOnWarnings=false -Pvalidation.git.failOnModified=false
   To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
   Daemon will be stopped at the end of the build
   Directory '/Users/risdenk/repos/apache/lucene/(custom paths)' (system property 'org.gradle.java.installations.paths') used for java installations does not exist
   
   > Task :lucene:core:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java:131: 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;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/AbstractPagedMutable.java:106: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           + 3 * Integer.BYTES;
           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (long) RamUsageEstimator.NUM_BYTES_OBJECT_HEADER'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/BytesRefArray.java:239: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         return RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + indices.length * Integer.BYTES;
                                                         ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (long) RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + indices.length * Integer.BYTES;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java:88: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       this.hardMaxBytesPerDWPT = config.getRAMPerThreadHardLimitMB() * 1024 * 1024;
                                                                             ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'this.hardMaxBytesPerDWPT = config.getRAMPerThreadHardLimitMB() * 1024L * 1024;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/PForUtil.java:37: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         IDENTITY_PLUS_ONE[i] = i + 1;
                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'IDENTITY_PLUS_ONE[i] = i + 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java:150: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           docBuffer[i] = code >>> 1;
                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'docBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java:786: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               posDeltaBuffer[i] = code >>> 1;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java:803: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               offsetStartDeltaBuffer[i] = deltaCode >>> 1;
                                                     ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetStartDeltaBuffer[i] = deltaCode >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java:1376: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               posDeltaBuffer[i] = code >>> 1;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java:1771: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               posDeltaBuffer[i] = code >>> 1;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java:1788: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               offsetStartDeltaBuffer[i] = deltaCode >>> 1;
                                                     ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetStartDeltaBuffer[i] = deltaCode >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsWriter.java:290: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       posDeltaBuffer[posBufferUpto] = position - lastPosition;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[posBufferUpto] = (long) position - lastPosition;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsWriter.java:309: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         offsetStartDeltaBuffer[posBufferUpto] = startOffset - lastStartOffset;
                                                             ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetStartDeltaBuffer[posBufferUpto] = (long) startOffset - lastStartOffset;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsWriter.java:310: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         offsetLengthBuffer[posBufferUpto] = endOffset - startOffset;
                                                       ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetLengthBuffer[posBufferUpto] = (long) endOffset - startOffset;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/LongBitSet.java:204: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (i << 6) + Long.numberOfTrailingZeros(word);
                           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (i << 6L) + Long.numberOfTrailingZeros(word);'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/LongBitSet.java:222: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         return (i << 6) + subIndex - Long.numberOfLeadingZeros(word); // See LUCENE-3197
                                    ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (i << 6L) + subIndex - Long.numberOfLeadingZeros(word);'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/LongBitSet.java:228: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (i << 6) + 63 - Long.numberOfLeadingZeros(word);
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (i << 6L) + 63 - Long.numberOfLeadingZeros(word);'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java:179: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               + Integer.BYTES * 2;
               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean '(long) nsize0 * (Integer.BYTES + Float.BYTES)'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java:184: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               + Integer.BYTES * 2;
               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean '(long) nsize * (Integer.BYTES + Float.BYTES)'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked2.java:67: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 6) & 3;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 6L) & 3;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked2.java:68: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 4) & 3;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 4L) & 3;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked2.java:69: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 2) & 3;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 2L) & 3;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/DirectReader.java:202: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readByte(offset + (index >>> 3)) >>> shift) & 0x1;
                                                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readByte(offset + (index >>> 3)) >>> shift) & 0x1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/DirectReader.java:222: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readByte(offset + (index >>> 2)) >>> shift) & 0x3;
                                                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readByte(offset + (index >>> 2)) >>> shift) & 0x3;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/DirectReader.java:243: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readByte(offset + (index >>> 1)) >>> shift) & 0xF;
                                                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readByte(offset + (index >>> 1)) >>> shift) & 0xF;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/DirectReader.java:283: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readShort(this.offset + offset) >>> shift) & 0xFFF;
                                                                 ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readShort(this.offset + offset) >>> shift) & 0xFFF;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/DirectReader.java:323: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readInt(this.offset + offset) >>> shift) & 0xFFFFF;
                                                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readInt(this.offset + offset) >>> shift) & 0xFFFFF;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/DirectReader.java:363: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readInt(this.offset + offset) >>> shift) & 0xFFFFFFF;
                                                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readInt(this.offset + offset) >>> shift) & 0xFFFFFFF;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked4.java:65: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 4) & 15;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 4L) & 15;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:71: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 7) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 7L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:72: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 6) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 6L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:73: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 5) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 5L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:74: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 4) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 4L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:75: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 3) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 3L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:76: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 2) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 2L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked1.java:77: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         values[valuesOffset++] = (block >>> 1) & 1;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'values[valuesOffset++] = (block >>> 1L) & 1;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/util/automaton/LevenshteinAutomata.java:361: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         final long bitLoc = bitsPerValue * index;
                                          ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'final long bitLoc = (long) bitsPerValue * index;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/search/comparators/MinDocIterator.java:61: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       return maxDoc - segmentMinDoc;
                     ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (long) maxDoc - segmentMinDoc;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java:356: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
                     return upper - lower;
                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (long) upper - lower;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/java/org/apache/lucene/search/MultiTermQueryConstantScoreWrapper.java:56: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           + RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_USED;
           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (long) RamUsageEstimator.NUM_BYTES_OBJECT_HEADER'?
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   40 warnings
   
   > Task :lucene:codecs:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/FSTOrdsOutputs.java:247: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           + output.bytes.length;
           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return 2L * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER'?
   /Users/risdenk/repos/apache/lucene/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.java:721: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           totalTermCount = end - start;
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'totalTermCount = (long) end - start;'?
   2 warnings
   
   > Task :lucene:facet:compileJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:queries:compileJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:sandbox:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/IndexSortSortedNumericDocValuesRangeQuery.java:555: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         return lastDoc - firstDoc;
                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return (long) lastDoc - firstDoc;'?
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   1 warning
   
   > Task :lucene:test-framework:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/search/BlockScoreQueryWrapper.java:154: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
                   return docs.length - 2;
                                      ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return docs.length - 2L;'?
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/search/AssertingBulkScorer.java:95: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
             interval = 1 + random.nextInt(10);
                          ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'interval = 1L + random.nextInt(10);'?
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/search/AssertingBulkScorer.java:97: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
             interval = 1 + random.nextInt(random.nextBoolean() ? 100 : 5000);
                          ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'interval = 1L + random.nextInt(random.nextBoolean() ? 100 : 5000);'?
   
   > Task :lucene:backward-codecs:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsReader.java:152: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           docBuffer[i] = code >>> 1;
                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'docBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsReader.java:804: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               posDeltaBuffer[i] = code >>> 1;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsReader.java:821: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               offsetStartDeltaBuffer[i] = deltaCode >>> 1;
                                                     ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetStartDeltaBuffer[i] = deltaCode >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsReader.java:1398: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               posDeltaBuffer[i] = code >>> 1;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsReader.java:1795: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               posDeltaBuffer[i] = code >>> 1;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[i] = code >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsReader.java:1812: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               offsetStartDeltaBuffer[i] = deltaCode >>> 1;
                                                     ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetStartDeltaBuffer[i] = deltaCode >>> 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/ForDeltaUtil.java:32: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         IDENTITY_PLUS_ONE[i] = i + 1;
                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'IDENTITY_PLUS_ONE[i] = i + 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectReader.java:105: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readByte(offset + (index >>> 3)) >>> shift) & 0x1;
                                                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readByte(offset + (index >>> 3)) >>> shift) & 0x1;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectReader.java:125: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readByte(offset + (index >>> 2)) >>> shift) & 0x3;
                                                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readByte(offset + (index >>> 2)) >>> shift) & 0x3;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectReader.java:145: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readByte(offset + (index >>> 1)) >>> shift) & 0xF;
                                                                  ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readByte(offset + (index >>> 1)) >>> shift) & 0xF;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectReader.java:185: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (in.readShort(this.offset + offset) >>> shift) & 0xFFF;
                                                                 ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) in.readShort(this.offset + offset) >>> shift) & 0xFFF;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectReader.java:227: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return (v >>> shift) & 0xFFFFF;
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return ((long) v >>> shift) & 0xFFFFF;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectReader.java:246: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           return in.readInt(offset + index * 3) >>> 8;
                                                 ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'return in.readInt(offset + index * 3) >>> 8L;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/compressing/Lucene50CompressingStoredFieldsReader.java:540: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
               offsets[1 + i] = (1 + i) * length;
                                        ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsets[1 + i] = (1L + i) * length;'?
   14 warnings
   
   > Task :lucene:analysis:common:compileJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:test-framework:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java:447: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
             longs[i] = (random().nextBoolean() ? -1 : 1) * random().nextInt(1024);
                                                          ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'longs[i] = (long) (random().nextBoolean() ? -1 : 1) * random().nextInt(1024);'?
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java:964: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           long offset = i * 8;
                           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long offset = i * 8L;'?
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java:1013: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           long offset = i * 4;
                           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long offset = i * 4L;'?
   /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java:1061: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           long offset = i * 2;
                           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long offset = i * 2L;'?
   7 warnings
   
   > Task :lucene:suggest:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/NRTSuggester.java:307: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       long maxQueueSize = topN * maxAnalyzedPathsPerOutput;
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long maxQueueSize = (long) topN * maxAnalyzedPathsPerOutput;'?
   /Users/risdenk/repos/apache/lucene/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionFieldsConsumer.java:229: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
             long weight = input.readVInt() - 1;
                                            ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long weight = input.readVInt() - 1L;'?
   2 warnings
   
   > Task :lucene:backward-codecs:compileTestJava
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsWriter.java:303: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       posDeltaBuffer[posBufferUpto] = position - lastPosition;
                                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'posDeltaBuffer[posBufferUpto] = (long) position - lastPosition;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsWriter.java:322: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         offsetStartDeltaBuffer[posBufferUpto] = startOffset - lastStartOffset;
                                                             ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetStartDeltaBuffer[posBufferUpto] = (long) startOffset - lastStartOffset;'?
   /Users/risdenk/repos/apache/lucene/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene84/Lucene84PostingsWriter.java:323: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         offsetLengthBuffer[posBufferUpto] = endOffset - startOffset;
                                                       ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'offsetLengthBuffer[posBufferUpto] = (long) endOffset - startOffset;'?
   3 warnings
   
   > Task :lucene:demo:compileJava
   /Users/risdenk/repos/apache/lucene/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java:84: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         long endTime = (i + 1) * 3600;
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long endTime = (i + 1L) * 3600;'?
   1 warning
   
   > Task :lucene:facet:compileTestJava
   Note: /Users/risdenk/repos/apache/lucene/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetAssociations.java uses or overrides a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:join:compileTestJava
   /Users/risdenk/repos/apache/lucene/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java:1934: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       final long linkLong = linkInt << 32 | linkInt;
                                           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'final long linkLong = linkInt << 32L | linkInt;'?
   1 warning
   
   > Task :lucene:highlighter:compileTestJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:memory:compileTestJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:monitor:compileTestJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:core:compileTestJava
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java:581: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       long queryRamBytesUsed = numQueries * (10 * QUERY_DEFAULT_RAM_BYTES_USED);
                                           ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long queryRamBytesUsed = (long) numQueries * (10 * QUERY_DEFAULT_RAM_BYTES_USED);'?
   
   > Task :lucene:queries:compileTestJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:core:compileTestJava
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.java:709: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       long offset = 100 + random().nextInt(100);
                         ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long offset = 100L + random().nextInt(100);'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.java:710: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       long smallestValue = 50 + random().nextInt(50);
                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long smallestValue = 50L + random().nextInt(50);'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java:250: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         expectedValues[i] = i + 1;
                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'expectedValues[i] = i + 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java:257: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           long value = (i + 1) * 2;
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long value = (i + 1L) * 2;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java:683: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         long value = rnd + 1;
                          ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long value = rnd + 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java:162: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         expectedValues[i] = i + 1;
                               ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'expectedValues[i] = i + 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java:169: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           long value = (i + 1) * 2;
                                ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long value = (i + 1L) * 2;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestBinaryDocValuesUpdates.java:572: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
         long value = rnd + 1;
                          ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long value = rnd + 1L;'?
   /Users/risdenk/repos/apache/lucene/lucene/core/src/test/org/apache/lucene/index/TestFieldUpdatesBuffer.java:271: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
       long docValue = 1 + random().nextInt(1000);
                         ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'long docValue = 1L + random().nextInt(1000);'?
   
   > Task :lucene:sandbox:compileTestJava
   Note: /Users/risdenk/repos/apache/lucene/lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestIndexSortSortedNumericDocValuesRangeQuery.java uses or overrides a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:spatial-extras:compileTestJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:replicator:compileTestJava
   Note: /Users/risdenk/repos/apache/lucene/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleTransLog.java uses or overrides a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   > Task :lucene:core:compileTestJava
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   10 warnings
   
   > Task :lucene:suggest:compileTestJava
   /Users/risdenk/repos/apache/lucene/lucene/suggest/src/test/org/apache/lucene/search/suggest/TestDocumentDictionary.java:405: warning: [IntLongMath] Expression of type int may overflow before being assigned to a long
           numericValue = 100 + i;
                              ^
       (see https://errorprone.info/bugpattern/IntLongMath)
     Did you mean 'numericValue = 100L + i;'?
   Note: Some input files use or override a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   1 warning
   
   > Task :lucene:test-framework:compileTestJava
   Note: /Users/risdenk/repos/apache/lucene/lucene/test-framework/src/test/org/apache/lucene/tests/util/TestReproduceMessage.java uses or overrides a deprecated API.
   Note: Recompile with -Xlint:deprecation for details.
   
   BUILD SUCCESSFUL in 1m 45s
   736 actionable tasks: 658 executed, 78 up-to-date
   ```


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] rmuir commented on pull request #11921: errorprone WIP

Posted by GitBox <gi...@apache.org>.
rmuir commented on PR #11921:
URL: https://github.com/apache/lucene/pull/11921#issuecomment-1311983115

   This is awesome, thank you for investigating @risdenk !!!


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] risdenk commented on a diff in pull request #11921: errorprone WIP

Posted by GitBox <gi...@apache.org>.
risdenk commented on code in PR #11921:
URL: https://github.com/apache/lucene/pull/11921#discussion_r1020443200


##########
gradle/validation/error-prone.gradle:
##########
@@ -68,6 +68,7 @@ allprojects { prj ->
 
         options.errorprone.disableWarningsInGeneratedCode = true
         options.errorprone.errorproneArgs = [
+            '-XepAllErrorsAsWarnings',

Review Comment:
   This is needed to prevent the build from failing if you want to see all the findings at once. The gradle build is setup to fail on errors so this converts to warnings and just allows printing.
   
   This assumes you use `-Pjavac.failOnWarnings=false` to also not fail the build on warnings :)



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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