Hi. First, I want to thank the author and contributors. This project is fantastic and has been very useful to me.
I was wondering if anyone else was seeing an IllegalArgumentException when running a query. The stacktrace is:
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:747) [rt.jar:1.7.0_71]
at java.util.TimSort.mergeAt(TimSort.java:483) [rt.jar:1.7.0_71]
at java.util.TimSort.mergeCollapse(TimSort.java:410) [rt.jar:1.7.0_71]
at java.util.TimSort.sort(TimSort.java:214) [rt.jar:1.7.0_71]
at java.util.TimSort.sort(TimSort.java:173) [rt.jar:1.7.0_71]
at java.util.Arrays.sort(Arrays.java:659) [rt.jar:1.7.0_71]
at java.util.Collections.sort(Collections.java:217) [rt.jar:1.7.0_71]
at com.googlecode.cqengine.resultset.connective.ResultSetIntersection.<init>(ResultSetIntersection.java:41) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl.retrieveRecursive(QueryEngineImpl.java:330) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl$2$1.next(QueryEngineImpl.java:351) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl$2$1.next(QueryEngineImpl.java:333) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.resultset.connective.ResultSetIntersection.<init>(ResultSetIntersection.java:38) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl.retrieveRecursive(QueryEngineImpl.java:330) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl$2$1.next(QueryEngineImpl.java:351) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl$2$1.next(QueryEngineImpl.java:333) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.resultset.connective.ResultSetIntersection.<init>(ResultSetIntersection.java:38) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl.retrieveRecursive(QueryEngineImpl.java:330) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.engine.impl.QueryEngineImpl.retrieve(QueryEngineImpl.java:241) [cqengine-1.3.2.jar:]
at com.googlecode.cqengine.collection.impl.ConcurrentIndexedCollection.retrieve(ConcurrentIndexedCollection.java:79) [cqengine-1.3.2.jar:]
It's hard to reproduce, but it looks like it's happening when one thread is executing a query at the same time another thread is modifying the ConcurrentIndexedCollection. The simple workaround is to add -Djava.util.Arrays.useLegacyMergeSort=true to revert back to the pre-Java 7 mergesort that silently ignored Comparators that broke the contract, however, it would probably be better to somehow take a snapshot of the size of the underlying Set (or whatever other method is being used to determine the merge cost for a particular ResultSet) so it can't change during the sort.