浏览代码

Fix compile problem in Eclipse (#64694)

Eclipse IDE compiler needs the TreeSet type to be explicit, at least in version 4.16.0, otherwise the
"pollFirst"/"pollLast" calls later in the method cannot be resolved.
Christoph Büscher 5 年之前
父节点
当前提交
b5a3b9470e

+ 2 - 1
x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/TestUtils.java

@@ -52,7 +52,8 @@ public final class TestUtils {
     }
 
     static SortedSet<Tuple<Long, Long>> mergeContiguousRanges(final SortedSet<Tuple<Long, Long>> ranges) {
-        return ranges.stream().collect(() -> new TreeSet<>(Comparator.comparingLong(Tuple::v1)), (gaps, gap) -> {
+        // Eclipse needs the TreeSet type to be explicit (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=568600)
+        return ranges.stream().collect(() -> new TreeSet<Tuple<Long, Long>>(Comparator.comparingLong(Tuple::v1)), (gaps, gap) -> {
             if (gaps.isEmpty()) {
                 gaps.add(gap);
             } else {