Fix some null warnings
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core / src / org / eclipse / tracecompass / segmentstore / core / BasicSegment.java
index c14f95c0c823bb23bfc8d8430fd78e135b4480d8..61b12b9997aaa4470c149798f49b356a706554d3 100644 (file)
@@ -26,9 +26,15 @@ public class BasicSegment implements ISegment {
 
     private static final long serialVersionUID = -3257452887960883177L;
 
-    private static final Comparator<ISegment> COMPARATOR = checkNotNull(Ordering
-            .from(SegmentComparators.INTERVAL_START_COMPARATOR)
-            .compound(SegmentComparators.INTERVAL_END_COMPARATOR));
+    private static final Comparator<ISegment> COMPARATOR;
+    static {
+        /* checkNotNull() has to be called separately, or else it breaks the
+         * type inference. */
+        Comparator<ISegment> comp = Ordering
+                .from(SegmentComparators.INTERVAL_START_COMPARATOR)
+                .compound(SegmentComparators.INTERVAL_END_COMPARATOR);
+        COMPARATOR = checkNotNull(comp);
+    }
 
     private final long fStart;
     private final long fEnd;
This page took 0.025949 seconds and 5 git commands to generate.