You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initialization of these lists uses the emptyList collection that is hard-coded to be an always empty list, and so will throw an error if anything is added to these lists.
this.associations = Collections.emptyList(); // = new ArrayList<T>(0);
}
In most of the code base this results in several isEmpty() checks to create a new ArrayList as necessary to add to it.
However, this does not occur in the deepCopy method, resulting in an error when I attempt to build a rather large regex (it has 10000 matchers, not yet at a minimum viable example, but I think this bug is pretty easy/clear fix).
Hi Edward, thanks for the bug report. It is indeed a bug in the deepCopy implementation. The fix should be to use the normal addTransition() method of the stateCopy, instead of trying to add them directly to the collection.
publicMutableState<T> deepCopy(Map<DeepCopy, DeepCopy> oldToNewObjects) {
@SuppressWarnings("unchecked")
// if there is a copy of this in the map, it will be of the same type.MutableState<T> stateCopy = (MutableState<T>) oldToNewObjects.get(this);
if (stateCopy == null) {
stateCopy = newMutableState<T>(this.isFinal);
oldToNewObjects.put(this, stateCopy);
for (Transition<T> transition : transitions) {
finalTransition<T> transitionCopy = transition.deepCopy(oldToNewObjects);
stateCopy.addTransition(transitionCopy);
}
}
returnstateCopy;
}
To set expectations here, I am unlikely to issue a bug fix for the current version of byteseek. I have been working on byteseek 3 for some years now, and that will be the next release I make. Hopefully this year, but I have some important other priorities taking up my time at the moment.
To further set expectations, all of the multi-string matching and searching in byteseek 3 is being placed in an "incubator" status. This means that it is largely untested code, whereas the rest of byteseek will be fully tested. I am not getting rid of it, but being honest, I do not know how much time I will have to develop this aspect of byteseek going forward. I guess if there is actual interest in this aspect, that might motivate me!
The initialization of these lists uses the emptyList collection that is hard-coded to be an always empty list, and so will throw an error if anything is added to these lists.
byteseek/src/main/java/net/byteseek/automata/MutableState.java
Lines 94 to 98 in 2600c05
In most of the code base this results in several
isEmpty()
checks to create a newArrayList
as necessary to add to it.However, this does not occur in the
deepCopy
method, resulting in an error when I attempt to build a rather large regex (it has 10000 matchers, not yet at a minimum viable example, but I think this bug is pretty easy/clear fix).byteseek/src/main/java/net/byteseek/automata/MutableState.java
Lines 418 to 431 in 2600c05
This is blocking me from being able to create a new
TrieMultiSequenceMatcher
The text was updated successfully, but these errors were encountered: