dweiss commented on a change in pull request #1732:
URL: https://github.com/apache/lucene-solr/pull/1732#discussion_r468369400



##########
File path: lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
##########
@@ -440,7 +440,7 @@ public static final SegmentInfos readCommit(Directory 
directory, ChecksumIndexIn
       if (format >= VERSION_70) { // oldest supported version
         CodecUtil.checkFooter(input, priorE);
       } else {
-        throw IOUtils.rethrowAlways(priorE);

Review comment:
       Leave this as it was (with throw ...) - don't know whether IntelliJ is 
smart enough to detect this method always throws an exception but other 
compilers are not (and this ensures the compiler sees it as a the only codepath 
leaving the clause).

##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
##########
@@ -709,7 +710,8 @@ private PendingBlock writeBlock(int prefixLength, boolean 
isFloor, int floorLead
 
           PendingTerm term = (PendingTerm) ent;
 
-          assert StringHelper.startsWith(term.termBytes, prefix): "term.term=" 
+ term.termBytes + " prefix=" + prefix;

Review comment:
       that 'term' class (PendingTerm) actually has a perfectly fine toString 
method... why not just remove termBytes and let it do its job?

##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
##########
@@ -741,7 +743,8 @@ private PendingBlock writeBlock(int prefixLength, boolean 
isFloor, int floorLead
           if (ent.isTerm) {
             PendingTerm term = (PendingTerm) ent;
 
-            assert StringHelper.startsWith(term.termBytes, prefix): 
"term.term=" + term.termBytes + " prefix=" + prefix;

Review comment:
       Same here.

##########
File path: lucene/core/src/java/org/apache/lucene/analysis/Analyzer.java
##########
@@ -367,12 +367,12 @@ public void close() {
     /**
      * Original source of the tokens.
      */
-    protected final Consumer<Reader> source;

Review comment:
       Don't change to package private scope here. It will prevent subclasses 
from outside of the package from accessing those fields (and there may be 
classes outside of Lucene code doing that).

##########
File path: lucene/core/src/java/org/apache/lucene/analysis/Analyzer.java
##########
@@ -367,12 +367,12 @@ public void close() {
     /**
      * Original source of the tokens.
      */
-    protected final Consumer<Reader> source;
+    final Consumer<Reader> source;
     /**
      * Sink tokenstream, such as the outer tokenfilter decorating
      * the chain. This can be the source if there are no filters.
      */
-    protected final TokenStream sink;

Review comment:
       Same here.

##########
File path: 
lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.java
##########
@@ -604,7 +605,7 @@ private PendingBlock writeBlock(int prefixLength, boolean 
isFloor, int floorLead
           assert ent.isTerm: "i=" + i;
 
           PendingTerm term = (PendingTerm) ent;
-          assert StringHelper.startsWith(term.termBytes, prefix): "term.term=" 
+ term.termBytes + " prefix=" + prefix;

Review comment:
       term has a toString method - use it.

##########
File path: 
lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.java
##########
@@ -640,7 +641,7 @@ private PendingBlock writeBlock(int prefixLength, boolean 
isFloor, int floorLead
           PendingEntry ent = pending.get(i);
           if (ent.isTerm) {
             PendingTerm term = (PendingTerm) ent;
-            assert StringHelper.startsWith(term.termBytes, prefix): 
"term.term=" + term.termBytes + " prefix=" + prefix;

Review comment:
       term has a toString method - use it.




----------------------------------------------------------------
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.

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



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

Reply via email to