dweiss commented on a change in pull request #1184: LUCENE-9142 Refactor IntSet
operations for determinize
URL: https://github.com/apache/lucene-solr/pull/1184#discussion_r369249556
##########
File path:
lucene/core/src/java/org/apache/lucene/util/automaton/SortedIntSet.java
##########
@@ -149,128 +156,32 @@ public void computeHash() {
hashCode = 683*hashCode + values[i];
}
}
+ stale = false;
}
+ /**
+ * Create a FrozenIntSet from the current values in this IntSet.
+ *
+ * @return a FrozenIntSet that has the same values and hashCode as this set
+ */
+ @SuppressForbidden(reason = "Arrays.copyOf is a candidate for JVM intrinsic
and we know our bounds are good")
Review comment:
Because copyOf was considered trappy -- the new length can be larger than
original size of the input array (and is then null or zero padded)... I'm not
sure it's worth having System.arraycopy instead... Maybe we could have a
utility method that assert-verifies newLength <= length and uses Arrays.copyOf.
Not sure.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]