jpountz commented on a change in pull request #579:
URL: https://github.com/apache/lucene/pull/579#discussion_r777604382
##########
File path:
lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java
##########
@@ -17,22 +17,19 @@
package org.apache.lucene.util.fst;
import java.io.IOException;
+
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.DataOutput;
import org.apache.lucene.util.RamUsageEstimator;
-import org.apache.lucene.util.SuppressForbidden;
/**
* An FST {@link Outputs} implementation where each output is a non-negative
long value.
*
* @lucene.experimental
*/
-@SuppressForbidden(reason = "Uses a Long instance as a marker")
public final class PositiveIntOutputs extends Outputs<Long> {
- // Ignore the deprecated constructor. We do want a unique object here.
- @SuppressWarnings({"all"})
- private static final Long NO_OUTPUT = new Long(0);
+ private static final Long NO_OUTPUT = 0L;
Review comment:
I guess -1 could work but it would be a bit weird since outputs are
supposed to form a semiring with `NO_OUTPUT` being the identity, ie. we'd be
using -1 as a way to represent 0.
I think it works correctly because the only requirement is that whenever an
operation returns 0 then the same instance is returned so that it can be
compared with `==`. We don't seem to require that this instance of 0 must be
different from other instances of 0.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]