Fix some null warnings
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 30 Oct 2015 09:47:55 +0000 (05:47 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 19 Nov 2015 02:54:15 +0000 (21:54 -0500)
Change-Id: Ibb291421d2625ab80151e4f193cc09eb8febe747
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/59129
Reviewed-by: Hudson CI
54 files changed:
analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/base/TmfGraph.java
analysis/org.eclipse.tracecompass.analysis.graph.ui/src/org/eclipse/tracecompass/internal/analysis/graph/ui/criticalpath/view/CriticalPathView.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesEntry.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/SystemCallLatencyStatisticsViewer.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/AbstractSegmentStoreScatterGraphViewer.java
btf/org.eclipse.tracecompass.btf.core/src/org/eclipse/tracecompass/btf/core/trace/BtfEventAspects.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDefinition2Test.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStream.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/ArrayDeclaration.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfEventFactory.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/graph/handlers/TraceEventHandlerExecutionGraph.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/graph/model/LttngSystemModel.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/vm/model/VirtualCPU.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/vm/module/VirtualMachineCpuAnalysis.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/vm/module/VirtualMachineStateProvider.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/lttng2/kernel/core/trace/LttngKernelTrace.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/analysis/debuginfo/UstDebugInfoAnalysisModule.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstEventFactory.java
pcap/org.eclipse.tracecompass.pcap.core/src/org/eclipse/tracecompass/internal/pcap/core/protocol/ipv4/IPv4Packet.java
pcap/org.eclipse.tracecompass.pcap.core/src/org/eclipse/tracecompass/internal/pcap/core/protocol/pcap/PcapPacket.java
pcap/org.eclipse.tracecompass.tmf.pcap.core/src/org/eclipse/tracecompass/internal/tmf/pcap/core/trace/PcapTrace.java
statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/treemap/TreeMapStore.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/AttributeTree.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/TransientState.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/ITmfStateSystem.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/interval/ITmfStateInterval.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlEntry.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfEventTypeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/synchronization/SyncTest.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialStateSystem.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisManager.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/ITmfEventField.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/ITmfEventType.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/TmfEventType.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/matching/TmfEventMatching.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/ITmfTrace.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfEventTypeCollectionHelper.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTrace.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceUtils.java
tmf/org.eclipse.tracecompass.tmf.remote.core.tests/src/org/eclipse/tracecompass/tmf/remote/core/tests/shell/CommandInputTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/widgetStubs/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/test/stub/model/TraceImpl.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/ITmfTreeViewerEntry.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/TmfTreeViewerEntry.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartAnalysisEntry.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/EventIterator.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/ITimeGraphEntry.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/Utils.java

index 715859b6904aa2920ffc97e1e43ddfa75cb0d433..561e0c5fd80f76aab183446112ffe7d699737154 100644 (file)
@@ -54,7 +54,7 @@ public class TmfGraph {
      * Constructor
      */
     public TmfGraph() {
-        fNodeMap = NonNullUtils.checkNotNull(ArrayListMultimap.<IGraphWorker, TmfVertex> create());
+        fNodeMap = NonNullUtils.checkNotNull(ArrayListMultimap.create());
         fReverse = new HashMap<>();
     }
 
index e5e5411172455b0163153663c523cdc2fea4c308..a067abc813e7d8c8390835f8af2e35a949926f0c 100644 (file)
@@ -82,9 +82,9 @@ public class CriticalPathView extends AbstractTimeGraphView {
             COLUMN_PROCESS
     };
 
-    private final Table<ITmfTrace, Object, List<ILinkEvent>> fLinks = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, Object, List<ILinkEvent>> create());
+    private final Table<ITmfTrace, Object, List<ILinkEvent>> fLinks = NonNullUtils.checkNotNull(HashBasedTable.create());
     /** The trace to entry list hash map */
-    private final Table<ITmfTrace, Object, TmfGraphStatistics> fObjectStatistics = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, Object, TmfGraphStatistics> create());
+    private final Table<ITmfTrace, Object, TmfGraphStatistics> fObjectStatistics = NonNullUtils.checkNotNull(HashBasedTable.create());
 
     private final CriticalPathContentProvider fContentProvider = new CriticalPathContentProvider();
 
@@ -203,7 +203,7 @@ public class CriticalPathView extends AbstractTimeGraphView {
         private @Nullable Object fCurrentObject;
 
         @Override
-        public @Nullable ITimeGraphEntry[] getElements(@Nullable Object inputElement) {
+        public ITimeGraphEntry[] getElements(@Nullable Object inputElement) {
             ITimeGraphEntry[] ret = new ITimeGraphEntry[0];
             if (inputElement instanceof List) {
                 List<?> list = (List<?>) inputElement;
@@ -225,6 +225,7 @@ public class CriticalPathView extends AbstractTimeGraphView {
                 buildEntryList(worker);
                 entries = workerEntries.get(worker);
             }
+
             return (entries == null) ?
                 new ITimeGraphEntry[0] :
                 NonNullUtils.checkNotNull(entries.toArray(new ITimeGraphEntry[entries.size()]));
@@ -275,10 +276,13 @@ public class CriticalPathView extends AbstractTimeGraphView {
         }
 
         private @Nullable TmfGraph getGraph(final ITmfTrace trace) {
-            CriticalPathModule module = Iterables.getFirst(TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
+            CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
+                    TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class),
+                    null);
             if (module == null) {
-                return null;
+                throw new IllegalStateException();
             }
+
             module.schedule();
             if (!module.waitForCompletion()) {
                 return null;
@@ -304,10 +308,12 @@ public class CriticalPathView extends AbstractTimeGraphView {
             if (trace == null) {
                 return null;
             }
-            CriticalPathModule module = Iterables.getFirst(TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
+            CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
+                    TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
             if (module == null) {
-                return null;
+                throw new IllegalStateException();
             }
+
             final TmfGraph graph = module.getCriticalPath();
             if (graph == null) {
                 return null;
@@ -475,9 +481,6 @@ public class CriticalPathView extends AbstractTimeGraphView {
         redraw();
 
         for (ITimeGraphEntry child : entry.getChildren()) {
-            if (child == null) {
-                throw new NullPointerException();
-            }
             buildStatusEvents(trace, (CriticalPathEntry) child);
         }
     }
index 441756f2a4453b1fe5c97d889e571cb83bec3c71..38a0b2d1f213049b02307b83dfef61c1cfe309b8 100644 (file)
@@ -501,9 +501,6 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
             if (thread > 0) {
                 break;
             }
-            if (trace == null) {
-                continue;
-            }
             ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID);
             if (ssq == null) {
                 continue;
@@ -558,9 +555,6 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
             return list;
         }
         for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) {
-            if (trace == null) {
-                continue;
-            }
             List<Integer> currentThreadQuarks = ss.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); //$NON-NLS-1$
             for (int currentThreadQuark : currentThreadQuarks) {
                 if (currentThreadQuark >= fullStates.get(0).size()) {
index 5a6be09c2cf6e8cb008048b60b73d0e1a68e21e2..8e1a128926c729ea00bab063574dce747e4b607d 100644 (file)
 
 package org.eclipse.tracecompass.analysis.os.linux.ui.views.resources;
 
+import java.util.Iterator;
+
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources.SoftIrqLabelProvider;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
 
@@ -184,4 +187,9 @@ public class ResourcesEntry extends TimeGraphEntry implements Comparable<ITimeGr
         return Integer.compare(this.getId(), o.getId());
     }
 
+    @Override
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
+        return super.getTimeEventsIterator();
+    }
+
 }
index 8150672c5beabb6d3784d9b4c4c339af43dcaac5..397c0851480b2eec6ca7594c4bf47f6d87aae3b0 100644 (file)
@@ -89,7 +89,7 @@ public class SystemCallLatencyStatisticsViewer extends AbstractSegmentStoreStati
             Iterator<Entry<String, SegmentStoreStatistics>> stats = perSyscallStats.entrySet().iterator();
             while (stats.hasNext()) {
                 Entry<String, SegmentStoreStatistics> statsEntry = stats.next();
-                syscalls.addChild(new SegmentStoreStatisticsEntry(checkNotNull(statsEntry.getKey()), checkNotNull(statsEntry.getValue())));
+                syscalls.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue()));
             }
         }
         return root;
index b56877d2b754bf7f6077e92e86752faa26641c42..620f44a9af2aa7595932262615322587255fa8c4 100644 (file)
@@ -67,7 +67,6 @@ import org.swtchart.Range;
  * @since 2.0
  */
 public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXLineChartViewer {
-    private static final List<ISegment> EMPTY_LIST = NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
 
     private final class CompactingSegmentStoreQuery extends Job {
         private static final long MAX_POINTS = 1000;
@@ -90,14 +89,14 @@ public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXL
             final long endTimeInNanos = getTimeInNanos(fCurrentRange.getEndTime());
             if (module == null) {
                 setWindowRange(startTimeInNanos, endTimeInNanos);
-                redraw(statusMonitor, startTimeInNanos, startTimeInNanos, EMPTY_LIST);
+                redraw(statusMonitor, startTimeInNanos, startTimeInNanos, Collections.EMPTY_LIST);
                 return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Analysis module not available"); //$NON-NLS-1$
             }
 
             final ISegmentStore<ISegment> results = module.getResults();
             if (results == null) {
                 setWindowRange(startTimeInNanos, endTimeInNanos);
-                redraw(statusMonitor, startTimeInNanos, startTimeInNanos, EMPTY_LIST);
+                redraw(statusMonitor, startTimeInNanos, startTimeInNanos, Collections.EMPTY_LIST);
                 return new Status(IStatus.INFO, Activator.PLUGIN_ID, "Analysis module does not have results"); //$NON-NLS-1$
             }
 
@@ -142,7 +141,7 @@ public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXL
                     continue;
                 }
                 if (statusMonitor.isCanceled()) {
-                    return NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
+                    return Collections.EMPTY_LIST;
                 }
                 if (!overlaps(last, next)) {
                     displayData.add(next);
@@ -156,7 +155,7 @@ public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXL
             final List<ISegment> list = new ArrayList<>();
             for (ISegment seg : iterable) {
                 if (statusMonitor.isCanceled()) {
-                    return NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
+                    return Collections.EMPTY_LIST;
                 }
                 list.add(seg);
             }
@@ -209,7 +208,7 @@ public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXL
     /**
      * Data to display
      */
-    private Collection<ISegment> fDisplayData = NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
+    private Collection<ISegment> fDisplayData = Collections.EMPTY_LIST;
 
     /**
      * Analysis completion listener
@@ -283,7 +282,7 @@ public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXL
                     }
                 });
             }
-            fDisplayData = NonNullUtils.checkNotNull(Collections.EMPTY_LIST);
+            fDisplayData = Collections.EMPTY_LIST;
         } else {
             Collection<ISegment> elements = (Collection<ISegment>) dataInput.getIntersectingElements(currentStart, currentEnd);
             // getIntersectingElements can return an unsorted iterable, make
@@ -411,13 +410,13 @@ public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXL
 
     /**
      * Returns the segment store analysis module
+     *
      * @param trace
      *            The trace to consider
      * @return the analysis module
      */
     protected @Nullable abstract AbstractSegmentStoreAnalysisModule getSegmentStoreAnalysisModule(ITmfTrace trace);
 
-
     // ------------------------------------------------------------------------
     // Signal handlers
     // ------------------------------------------------------------------------
index 873793c253ebef28592fcbc11656f100ff74a1d9..d09819841e8a6f94c2d512ba868a57e7fd64809c 100644 (file)
@@ -14,7 +14,8 @@
 
 package org.eclipse.tracecompass.btf.core.trace;
 
-import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.btf.core.event.BtfEvent;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
@@ -28,11 +29,12 @@ import com.google.common.collect.ImmutableList;
  *
  * @author Alexandre Montplaisir
  */
+@NonNullByDefault
 public final class BtfEventAspects {
 
     private BtfEventAspects() {}
 
-    private static final @NonNull Iterable<ITmfEventAspect> BTF_ASPECTS =
+    private static final Iterable<ITmfEventAspect> BTF_ASPECTS =
             NonNullUtils.checkNotNull(ImmutableList.of(
                     ITmfEventAspect.BaseAspects.TIMESTAMP,
                     new BtfSourceAspect(),
@@ -60,7 +62,7 @@ public final class BtfEventAspects {
         }
 
         @Override
-        public String resolve(ITmfEvent event) {
+        public @Nullable String resolve(ITmfEvent event) {
             if (!(event instanceof BtfEvent)) {
                 return EMPTY_STRING;
             }
@@ -86,7 +88,7 @@ public final class BtfEventAspects {
         }
 
         @Override
-        public String resolve(ITmfEvent event) {
+        public @Nullable String resolve(ITmfEvent event) {
             if (!(event instanceof BtfEvent)) {
                 return EMPTY_STRING;
             }
@@ -100,7 +102,7 @@ public final class BtfEventAspects {
      *
      * @return The aspects
      */
-    public static @NonNull Iterable<ITmfEventAspect> getAspects() {
+    public static Iterable<ITmfEventAspect> getAspects() {
         return BTF_ASPECTS;
     }
 }
\ No newline at end of file
index 6f71cb2c8c6aa428db8f7617b7a516fefc6d465d..df04f5c28279eb2cb89c39f1bd97a79ce7df0cd9 100644 (file)
@@ -67,35 +67,34 @@ public class ArrayDefinition2Test {
 
     private ArrayDefinition createLongArray() {
         IntegerDeclaration decl = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "none", 8);
-        List<Definition> defs = createIntDefs(10, 32);
+        List<@NonNull Definition> defs = createIntDefs(10, 32);
         ArrayDefinition temp = setUpDeclaration(decl, defs);
         return temp;
     }
 
     private ArrayDefinition createCharArray() {
         IntegerDeclaration decl = IntegerDeclaration.createDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "none", 8);
-        List<Definition> defs = createIntDefs(4, 8);
+        List<@NonNull Definition> defs = createIntDefs(4, 8);
         ArrayDefinition temp = setUpDeclaration(decl, defs);
         return temp;
     }
 
     private ArrayDefinition createStringArray() {
         StringDeclaration strDecl = StringDeclaration.getStringDeclaration(Encoding.UTF8);
-        List<Definition> defs = createDefs();
+        List<@NonNull Definition> defs = createDefs();
         ArrayDefinition temp = setUpDeclaration(strDecl, defs);
         return temp;
     }
 
     private ArrayDefinition setUpDeclaration(@NonNull IDeclaration decl,
-            @NonNull List<Definition> defs) {
+            @NonNull List<@NonNull Definition> defs) {
         CompoundDeclaration ad = new ArrayDeclaration(0, decl);
         ArrayDefinition temp = new ArrayDefinition(ad, this.trace, "Testx", defs);
         return temp;
     }
 
-    @NonNull
-    private static List<Definition> createIntDefs(int size, int bits) {
-        List<Definition> defs = new ArrayList<>(size);
+    private static @NonNull List<@NonNull Definition> createIntDefs(int size, int bits) {
+        List<@NonNull Definition> defs = new ArrayList<>(size);
         for (int i = 0; i < size; i++) {
             String content = "test" + i;
             defs.add(new IntegerDefinition(IntegerDeclaration.createDeclaration(bits, false,
@@ -104,10 +103,9 @@ public class ArrayDefinition2Test {
         return defs;
     }
 
-    @NonNull
-    private static List<Definition> createDefs() {
+    private static @NonNull List<@NonNull Definition> createDefs() {
         int size = 4;
-        List<Definition> defs = new ArrayList<>();
+        List<@NonNull Definition> defs = new ArrayList<>();
         for (int i = 0; i < size; i++) {
             String content = "test" + i;
             defs.add(new StringDefinition(
@@ -125,7 +123,7 @@ public class ArrayDefinition2Test {
         CompoundDeclaration declaration = (CompoundDeclaration) charArrayFixture.getDeclaration();
         String fieldName = "";
 
-        ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new Definition[0]));
+        ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new @NonNull Definition[0]));
         assertNotNull(result);
     }
 
@@ -140,7 +138,7 @@ public class ArrayDefinition2Test {
         IDefinitionScope definitionScope = getDefinitionScope();
 
         String fieldName = "";
-        ArrayDefinition result = new ArrayDefinition(declaration, definitionScope, fieldName, Arrays.asList(new Definition[0]));
+        ArrayDefinition result = new ArrayDefinition(declaration, definitionScope, fieldName, Arrays.asList(new @NonNull Definition[0]));
         assertNotNull(result);
     }
 
@@ -170,7 +168,7 @@ public class ArrayDefinition2Test {
      */
     @Test
     public void testgetElem_withDefs() {
-        List<Definition> defs = createDefs();
+        List<@NonNull Definition> defs = createDefs();
         IDefinitionScope definitionScope = getDefinitionScope();
         ArrayDefinition ad = new ArrayDefinition((CompoundDeclaration) charArrayFixture.getDeclaration(), definitionScope, "test", defs);
         int j = 1;
index 5c4b008eb847dc7366d081853f27fd84dfdc1e32..b0fb0e54fc19456b5c9f515747d1574a8f5de6ca 100644 (file)
@@ -14,7 +14,6 @@ package org.eclipse.tracecompass.ctf.core.trace;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -226,9 +225,13 @@ public class CTFStream {
      *
      * @return The event declarations for this stream
      */
-    public @NonNull Collection<IEventDeclaration> getEventDeclarations() {
-        List<IEventDeclaration> retVal = new ArrayList<>(fEvents);
-        retVal.removeAll(Collections.<IEventDeclaration> singletonList(null));
+    public @NonNull Collection<@NonNull IEventDeclaration> getEventDeclarations() {
+        List<@NonNull IEventDeclaration> retVal = new ArrayList<>();
+        for (IEventDeclaration eventDeclaration : fEvents) {
+            if (eventDeclaration != null) {
+                retVal.add(eventDeclaration);
+            }
+        }
         return retVal;
     }
 
index 3983f34804e8842971bcb49054c77185fb3ef1b4..410012c408696067e4cee57bb420c01e778853da 100644 (file)
@@ -113,7 +113,7 @@ public final class ArrayDeclaration extends CompoundDeclaration {
 
             return new ByteArrayDefinition(this, definitionScope, fieldName, data);
         }
-        @NonNull List<Definition> definitions = read(input, definitionScope, fieldName);
+        @NonNull List<@NonNull Definition> definitions = read(input, definitionScope, fieldName);
         return new ArrayDefinition(this, definitionScope, fieldName, definitions);
     }
 
index d621d5266f6c148927c212903d8190ce40dc9b33..e6c1ae15e94453de8925c4c8482225e8b1e630b4 100644 (file)
@@ -13,6 +13,7 @@
 
 package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
@@ -145,7 +146,7 @@ public class CtfIterator extends CTFTraceReader
         if (top != null) {
             if (!fCurLocation.equals(fPreviousLocation)) {
                 fPreviousLocation = fCurLocation;
-                fPreviousEvent = fTrace.getEventFactory().createEvent(fTrace, top.getCurrentEvent(), top.getFilename());
+                fPreviousEvent = fTrace.getEventFactory().createEvent(fTrace, checkNotNull(top.getCurrentEvent()), top.getFilename());
             }
             return fPreviousEvent;
         }
index 4e8cc087857719e871a96d87c762420139c3a6b5..0d019fba7a50d03604e907ff29a459f6d0ab20fe 100644 (file)
@@ -12,7 +12,8 @@
 
 package org.eclipse.tracecompass.tmf.ctf.core.event;
 
-import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
 import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
@@ -31,9 +32,10 @@ import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
  *
  * @author Alexandre Montplaisir
  */
+@NonNullByDefault
 public class CtfTmfEventFactory {
 
-    private static final @NonNull CtfTmfEventFactory INSTANCE = new CtfTmfEventFactory();
+    private static final CtfTmfEventFactory INSTANCE = new CtfTmfEventFactory();
 
     /**
      * The file name to use when none is specified.
@@ -42,7 +44,7 @@ public class CtfTmfEventFactory {
      *
      * @since 2.0
      */
-    protected static final @NonNull String NO_STREAM = "No stream"; //$NON-NLS-1$
+    protected static final String NO_STREAM = "No stream"; //$NON-NLS-1$
 
     /**
      * Protected constructor, only for use by sub-classes. Users should call
@@ -58,7 +60,7 @@ public class CtfTmfEventFactory {
      * @return The instance
      * @since 2.0
      */
-    public static @NonNull CtfTmfEventFactory instance() {
+    public static CtfTmfEventFactory instance() {
         return INSTANCE;
     }
 
@@ -74,7 +76,7 @@ public class CtfTmfEventFactory {
      * @return The newly-built CtfTmfEvent
      * @since 2.0
      */
-    public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, String fileName) {
+    public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, @Nullable String fileName) {
 
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
@@ -83,7 +85,7 @@ public class CtfTmfEventFactory {
 
         int sourceCPU = eventDef.getCPU();
 
-        String reference = fileName == null ? NO_STREAM : fileName;
+        String reference = (fileName == null ? NO_STREAM : fileName);
 
         /* Handle the special case of lost events */
         if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
index b3cd9261ccc963b5d80a620d929c8065142b0c19..4bc464bc27150468d8e53a08497bd51c22d4f059 100644 (file)
@@ -97,7 +97,7 @@ public class CtfTmfTrace extends TmfTrace
      * Event aspects available for all CTF traces
      * @since 1.0
      */
-    protected static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
+    protected static final @NonNull Collection<@NonNull ITmfEventAspect> CTF_ASPECTS =
             checkNotNull(ImmutableList.of(
                     ITmfEventAspect.BaseAspects.TIMESTAMP,
                     new CtfChannelAspect(),
@@ -117,11 +117,10 @@ public class CtfTmfTrace extends TmfTrace
     // Fields
     // -------------------------------------------
 
-    private final Map<String, CtfTmfEventType> fContainedEventTypes =
-            Collections.synchronizedMap(new HashMap<String, CtfTmfEventType>());
+    private final Map<@NonNull String, @NonNull CtfTmfEventType> fContainedEventTypes =
+            Collections.synchronizedMap(new HashMap<>());
 
-    private final CtfIteratorManager fIteratorManager =
-            new CtfIteratorManager(this);
+    private final CtfIteratorManager fIteratorManager = new CtfIteratorManager(this);
 
     private final @NonNull CtfTmfEventFactory fEventFactory;
 
@@ -481,7 +480,7 @@ public class CtfTmfTrace extends TmfTrace
      * Gets the list of declared events
      */
     @Override
-    public Set<CtfTmfEventType> getContainedEventTypes() {
+    public Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
         return ImmutableSet.copyOf(fContainedEventTypes.values());
     }
 
index d7ab07235b6a5428f4a86927e7885e3b8c8ffe6d..4dcd187944a0f3afd19f1a35ac498ac39f135aff 100644 (file)
@@ -74,7 +74,7 @@ public class TraceEventHandlerExecutionGraph extends BaseHandler {
      */
     public TraceEventHandlerExecutionGraph(LttngKernelExecGraphProvider provider) {
         super(provider);
-        fKernel = NonNullUtils.checkNotNull(HashBasedTable.<String, Integer, LttngWorker> create());
+        fKernel = NonNullUtils.checkNotNull(HashBasedTable.create());
 
         fTcpNodes = new HashMap<>();
         fMatchProcessing = new IMatchProcessingUnit() {
index d3b264c35226a1d14df6decb00702a70597a525a..5bb46fe9d6cde3b3c55a24dc846d9fd572608c5b 100644 (file)
@@ -34,8 +34,8 @@ import com.google.common.collect.Table;
  */
 public class LttngSystemModel {
 
-    private final Table<String, Integer, HostThread> fCurrentTids = NonNullUtils.checkNotNull(HashBasedTable.<String, Integer, HostThread> create());
-    private final Table<String, Integer, Stack<LttngInterruptContext>> fIntCtxStacks = NonNullUtils.checkNotNull(HashBasedTable.<String, Integer, Stack<LttngInterruptContext>> create());
+    private final Table<String, Integer, HostThread> fCurrentTids = NonNullUtils.checkNotNull(HashBasedTable.create());
+    private final Table<String, Integer, Stack<LttngInterruptContext>> fIntCtxStacks = NonNullUtils.checkNotNull(HashBasedTable.create());
     private final Map<HostThread, LttngWorker> fWorkerMap = new HashMap<>();
 
     /**
index 66fc0e0f3bcd04df255a0fba2bb5b367662317de..2e2a3be3a6daa644037e67b2c4bf6c069f6513c5 100644 (file)
@@ -26,7 +26,7 @@ import com.google.common.collect.Table;
  */
 public class VirtualCPU {
 
-    private static final Table<VirtualMachine, Long, @Nullable VirtualCPU> VIRTUAL_CPU_TABLE = NonNullUtils.checkNotNull(HashBasedTable.<VirtualMachine, Long, VirtualCPU> create());
+    private static final Table<VirtualMachine, Long, @Nullable VirtualCPU> VIRTUAL_CPU_TABLE = NonNullUtils.checkNotNull(HashBasedTable.create());
 
     private final VirtualMachine fVm;
     private final Long fCpuId;
index 22b17a7c0d614302cf535d094b3f4e74102bf481..617ac827f1b6db127ae20633d899720e633c1091 100644 (file)
@@ -58,7 +58,7 @@ import com.google.common.collect.TreeMultimap;
 public class VirtualMachineCpuAnalysis extends TmfStateSystemAnalysisModule {
 
     // TODO: Update with event layout when requirements are back */
-    static final Set<String> REQUIRED_EVENTS = NonNullUtils.checkNotNull(ImmutableSet.<String> of(
+    static final Set<String> REQUIRED_EVENTS = NonNullUtils.checkNotNull(ImmutableSet.of(
             // LttngStrings.SCHED_SWITCH
             ));
 
index 08904b328e174d378c5062d7a15a9f62ed9168f3..f89e267bc7cf7eb50a4c70c50032aa71669c2a78 100644 (file)
@@ -100,7 +100,7 @@ public class VirtualMachineStateProvider extends AbstractTmfStateProvider {
         super(experiment, "Virtual Machine State Provider"); //$NON-NLS-1$
 
         fModel = new QemuKvmVmModel(experiment);
-        Table<ITmfTrace, String, @Nullable Integer> table = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, String, Integer> create());
+        Table<ITmfTrace, String, @Nullable Integer> table = NonNullUtils.checkNotNull(HashBasedTable.create());
         fEventNames = table;
         fLayouts = new HashMap<>();
     }
index 26c7f94f08e53a70bb572608a3edaafd95eeb2c3..2ec5362895c3cf24ffd1b3a9ad502df7ba1b503d 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.tracecompass.lttng2.kernel.core.trace;
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -35,6 +36,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTraceValidationStatus;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfUtils;
@@ -162,4 +164,13 @@ public class LttngKernelTrace extends CtfTmfTrace implements IKernelTrace {
          return LTTNG_KERNEL_ASPECTS;
     }
 
+    /*
+     * Needs explicit @NonNull generic type annotation. Can be removed once this
+     * class becomes @NonNullByDefault.
+     */
+    @Override
+    public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+        return super.getContainedEventTypes();
+    }
+
 }
index a529aba78d0c551ed413f9218b6cb6caff372d06..c6308d13d1313f93e919d0d7eab9d634a875ed41 100644 (file)
@@ -76,7 +76,7 @@ public class UstDebugInfoAnalysisModule extends TmfStateSystemAnalysisModule {
     public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
         // TODO specify actual requirements once the requirement-checking is
         // implemented. This analysis needs "ip" and "vpid" contexts.
-        return checkNotNull(Collections.EMPTY_SET);
+        return Collections.EMPTY_SET;
     }
 
     @Override
index 9b6dca621ad056562a964d23cc79017cee004f04..87e52060af372eef837da8a367ead56cc6d63f48 100644 (file)
@@ -10,6 +10,7 @@
 package org.eclipse.tracecompass.lttng2.ust.core.trace;
 
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
 import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
@@ -42,7 +43,7 @@ public class LttngUstEventFactory extends CtfTmfEventFactory {
     }
 
     @Override
-    public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, String fileName) {
+    public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, @Nullable String fileName) {
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
         final long ts = eventDef.getTimestamp();
index 44d9e6627711840fb88fe54ec17af3e48534282d..5574fddab37a79ad8c2e4bfbcafc62b5025c402d 100644 (file)
@@ -13,6 +13,7 @@
 package org.eclipse.tracecompass.internal.pcap.core.protocol.ipv4;
 
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
 
 import java.net.Inet4Address;
 import java.net.InetAddress;
@@ -22,6 +23,7 @@ import java.nio.ByteOrder;
 import java.util.Arrays;
 import java.util.Map;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
@@ -435,7 +437,7 @@ public class IPv4Packet extends Packet {
     public Map<String, String> getFields() {
         Map<String, String> map = fFields;
         if (map == null) {
-            Builder<String, String> builder = ImmutableMap.<String, String> builder()
+            Builder<@NonNull String, @NonNull String> builder = ImmutableMap.<@NonNull String, @NonNull String> builder()
                     .put("Version", String.valueOf(fVersion)) //$NON-NLS-1$
                     .put("Header Length", String.valueOf(getHeaderLength()) + " bytes") //$NON-NLS-1$ //$NON-NLS-2$
                     .put("Differentiated Services Field", String.format("%s%02x", "0x", fDSCP)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -448,8 +450,8 @@ public class IPv4Packet extends Packet {
                     .put("Time to live", String.valueOf(fTimeToLive)) //$NON-NLS-1$
                     .put("Protocol", IPProtocolNumberHelper.toString(fIpDatagramProtocol) + " (" + String.valueOf(fIpDatagramProtocol) + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                     .put("Checksum", String.format("%s%04x", "0x", fHeaderChecksum)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-                    .put("Source IP Address", fSourceIpAddress.getHostAddress()) //$NON-NLS-1$
-                    .put("Destination IP Address", fDestinationIpAddress.getHostAddress()); //$NON-NLS-1$
+                    .put("Source IP Address", nullToEmptyString(fSourceIpAddress.getHostAddress())) //$NON-NLS-1$
+                    .put("Destination IP Address", nullToEmptyString(fDestinationIpAddress.getHostAddress())); //$NON-NLS-1$
             byte[] options = fOptions;
             if (options == null) {
                 builder.put("Options", EMPTY_STRING); //$NON-NLS-1$
index be6ae08961efa94dbc239fac63753581e528cce8..cd0ad45cfe0a63980f04aeefff93097fd875dd4d 100644 (file)
@@ -236,7 +236,7 @@ public class PcapPacket extends Packet {
 
     @Override
     public PcapEndpoint getSourceEndpoint() {
-        @Nullable PcapEndpoint endpoint = fSourceEndpoint;
+        PcapEndpoint endpoint = fSourceEndpoint;
         if (endpoint == null) {
             endpoint = new PcapEndpoint(this, true);
         }
@@ -246,7 +246,6 @@ public class PcapPacket extends Packet {
 
     @Override
     public PcapEndpoint getDestinationEndpoint() {
-        @Nullable
         PcapEndpoint endpoint = fDestinationEndpoint;
 
         if (endpoint == null) {
@@ -262,7 +261,7 @@ public class PcapPacket extends Packet {
     public Map<String, String> getFields() {
         Map<String, String> map = fFields;
         if (map == null) {
-            ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder();
+            ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
             builder.put("Frame", String.valueOf(fPacketIndex)); //$NON-NLS-1$
             builder.put("Frame Length", String.valueOf(fOriginalLength) + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
             builder.put("Capture Length", String.valueOf(fIncludedLength) + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
index 2f5b911311a1fda35b0bbe7d634bff6b86e8689b..273e788deb0f42aeaf04e797ce48910282d08694 100644 (file)
@@ -15,6 +15,7 @@
 package org.eclipse.tracecompass.internal.tmf.pcap.core.trace;
 
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
 
 import java.io.IOException;
 import java.nio.channels.ClosedChannelException;
@@ -28,9 +29,7 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
 import org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket;
 import org.eclipse.tracecompass.internal.pcap.core.trace.BadPcapFileException;
@@ -70,7 +69,7 @@ public class PcapTrace extends TmfTrace implements ITmfTraceProperties {
     /** pcap trace type id as defined in plugin.xml */
     public static final String TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.pcap.core.pcaptrace"; //$NON-NLS-1$
 
-    private @NonNull static final Collection<ITmfEventAspect> PCAP_ASPECTS =
+    private static final Collection<ITmfEventAspect> PCAP_ASPECTS =
             checkNotNull(ImmutableList.of(
                     ITmfEventAspect.BaseAspects.TIMESTAMP,
                     PcapSourceAspect.INSTANCE,
@@ -80,7 +79,7 @@ public class PcapTrace extends TmfTrace implements ITmfTraceProperties {
                     ITmfEventAspect.BaseAspects.CONTENTS
                     ));
 
-    private @NonNull static final String EMPTY_STRING = ""; //$NON-NLS-1$
+    private static final String EMPTY_STRING = ""; //$NON-NLS-1$
     private static final int CONFIDENCE = 50;
     private @Nullable PcapFile fPcapFile;
     private @Nullable Map<String, String> fTraceProperties = null;
@@ -248,18 +247,18 @@ public class PcapTrace extends TmfTrace implements ITmfTraceProperties {
     public synchronized Map<String, String> getTraceProperties() {
         PcapFile pcap = fPcapFile;
         if (pcap == null) {
-            return checkNotNull(Collections.<String, String> emptyMap());
+            return Collections.emptyMap();
         }
 
         Map<String, String> properties = fTraceProperties;
         if (properties == null) {
             ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
-            builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_Version), String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())); //$NON-NLS-1$
-            builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_TimeZoneCorrection), pcap.getTimeZoneCorrection() + " s"); //$NON-NLS-1$
-            builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_TimestampAccuracy), String.valueOf(pcap.getTimeAccuracy()));
-            builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_MaxSnapLength), pcap.getSnapLength() + " bytes"); //$NON-NLS-1$
-            builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_LinkLayerHeaderType), LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-            builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_FileEndianness), pcap.getByteOrder().toString());
+            builder.put(nullToEmptyString(Messages.PcapTrace_Version), String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())); //$NON-NLS-1$
+            builder.put(nullToEmptyString(Messages.PcapTrace_TimeZoneCorrection), pcap.getTimeZoneCorrection() + " s"); //$NON-NLS-1$
+            builder.put(nullToEmptyString(Messages.PcapTrace_TimestampAccuracy), String.valueOf(pcap.getTimeAccuracy()));
+            builder.put(nullToEmptyString(Messages.PcapTrace_MaxSnapLength), pcap.getSnapLength() + " bytes"); //$NON-NLS-1$
+            builder.put(nullToEmptyString(Messages.PcapTrace_LinkLayerHeaderType), LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+            builder.put(nullToEmptyString(Messages.PcapTrace_FileEndianness), nullToEmptyString(pcap.getByteOrder().toString()));
 
             return checkNotNull(builder.build());
 
index 01ce5017c848f6cda6c931420e016434ea7d2abd..0bca75b6f7ddc18b66a522c0ce7ebc09acf817f8 100644 (file)
@@ -79,11 +79,11 @@ public class TreeMapStore<E extends ISegment> implements ISegmentStore<E> {
          * The same is done for the end times index, but swapping the first two
          * comparators instead.
          */
-        fStartTimesIndex = checkNotNull(TreeMultimap.<Long, E> create(
+        fStartTimesIndex = checkNotNull(TreeMultimap.create(
                 SegmentComparators.LONG_COMPARATOR,
                 Ordering.from(SegmentComparators.INTERVAL_END_COMPARATOR).compound(Ordering.natural())));
 
-        fEndTimesIndex = checkNotNull(TreeMultimap.<Long, E> create(
+        fEndTimesIndex = checkNotNull(TreeMultimap.create(
                 SegmentComparators.LONG_COMPARATOR,
                 Ordering.from(SegmentComparators.INTERVAL_START_COMPARATOR).compound(Ordering.natural())));
 
@@ -164,7 +164,7 @@ public class TreeMapStore<E extends ISegment> implements ISegmentStore<E> {
     public Object[] toArray() {
         fLock.readLock().lock();
         try {
-            return checkNotNull(fStartTimesIndex.values().toArray());
+            return fStartTimesIndex.values().toArray();
         } finally {
             fLock.readLock().unlock();
         }
@@ -174,7 +174,7 @@ public class TreeMapStore<E extends ISegment> implements ISegmentStore<E> {
     public <T> T[] toArray(T @Nullable[] a) {
         fLock.readLock().lock();
         try {
-            return checkNotNull(fStartTimesIndex.values().toArray(a));
+            return fStartTimesIndex.values().toArray(a);
         } finally {
             fLock.readLock().unlock();
         }
index 97f8777de4466fc0781fe79e4dc1c588b3e29437..54ea463e83e88d404e0147dd6300feb7170f3022 100644 (file)
@@ -258,9 +258,9 @@ public final class AttributeTree {
      *             If 'attributeQuark' is invalid, or if there is no attrbiute
      *             associated to it.
      */
-    public synchronized @NonNull List<Integer> getSubAttributes(int attributeQuark, boolean recursive)
+    public synchronized @NonNull List<@NonNull Integer> getSubAttributes(int attributeQuark, boolean recursive)
             throws AttributeNotFoundException {
-        List<Integer> listOfChildren = new ArrayList<>();
+        List<@NonNull Integer> listOfChildren = new ArrayList<>();
         Attribute startingAttribute;
 
         /* Check if the quark is valid */
index 09ce7cbef3cdc3b0a3372e306df3fed70516d5f4..d4c85ff77cc79f5bae48f31d62597d7d1e18faff 100644 (file)
@@ -25,6 +25,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
@@ -279,8 +280,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
     }
 
     @Override
-    public List<Integer> getQuarks(String... pattern) {
-        List<Integer> quarks = new LinkedList<>();
+    public List<@NonNull Integer> getQuarks(String... pattern) {
+        List<@NonNull Integer> quarks = new LinkedList<>();
         List<String> prefix = new LinkedList<>();
         List<String> suffix = new LinkedList<>();
         boolean split = false;
@@ -544,7 +545,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
      * @param newStateIntervals
      *            The new List of state values to use as ongoing state info
      */
-    protected void replaceOngoingState(@NonNull List<ITmfStateInterval> newStateIntervals) {
+    protected void replaceOngoingState(@NonNull List<@NonNull ITmfStateInterval> newStateIntervals) {
         transState.replaceOngoingState(newStateIntervals);
     }
 
@@ -560,7 +561,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
         }
 
         final int nbAttr = getNbAttributes();
-        List<ITmfStateInterval> stateInfo = new ArrayList<>(nbAttr);
+        List<@Nullable ITmfStateInterval> stateInfo = new ArrayList<>(nbAttr);
 
         /* Bring the size of the array to the current number of attributes */
         for (int i = 0; i < nbAttr; i++) {
index b7c4fc81f45392e80b7098ab840cb28ea16cc83d..dfa22f0ebc21938fce02ef39b0e76e0c2547476f 100644 (file)
@@ -343,7 +343,7 @@ public class TransientState {
      * @param t
      *            The requested timestamp
      */
-    public void doQuery(List<ITmfStateInterval> stateInfo, long t) {
+    public void doQuery(List<@Nullable ITmfStateInterval> stateInfo, long t) {
         fRWLock.readLock().lock();
         try {
             if (!this.fIsActive) {
index 3f63cb6955deaf2509f7849754467680790bea2b..3236bfc4a88a8bf69307542784619fe7ae1cf79e 100644 (file)
@@ -172,7 +172,7 @@ public interface ITmfStateSystem {
      * @throws AttributeNotFoundException
      *             If the quark was not existing or invalid.
      */
-    @NonNull List<Integer> getSubAttributes(int quark, boolean recursive)
+    @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
             throws AttributeNotFoundException;
 
     /**
@@ -195,7 +195,7 @@ public interface ITmfStateSystem {
      * @throws AttributeNotFoundException
      *             If the 'quark' was not existing or invalid.
      */
-    List<Integer> getSubAttributes(int quark, boolean recursive, String pattern)
+    @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
             throws AttributeNotFoundException;
 
     /**
@@ -222,7 +222,7 @@ public interface ITmfStateSystem {
      *         the pattern. If no attribute matched, the list will be empty (but
      *         not null).
      */
-    List<Integer> getQuarks(String... pattern);
+    @NonNull List<@NonNull Integer> getQuarks(String... pattern);
 
     /**
      * Return the name assigned to this quark. This returns only the "basename",
@@ -327,7 +327,7 @@ public interface ITmfStateSystem {
      * @throws StateSystemDisposedException
      *             If the query is sent after the state system has been disposed
      */
-    @NonNull List<ITmfStateInterval> queryFullState(long t)
+    @NonNull List<@NonNull ITmfStateInterval> queryFullState(long t)
             throws StateSystemDisposedException;
 
     /**
index b3279219fdebee0b5d5b0d908bf44f67a8ebc506..93b019486b13c90255c3521029fcd2512671a258 100644 (file)
@@ -12,6 +12,7 @@
 
 package org.eclipse.tracecompass.statesystem.core.interval;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 
 /**
@@ -51,7 +52,7 @@ public interface ITmfStateInterval {
      *
      * @return the state value represented by this interval
      */
-    ITmfStateValue getStateValue();
+    @NonNull ITmfStateValue getStateValue();
 
     /**
      * Test if this interval intersects another timestamp, inclusively.
index 7b9901dba4bb00ee7c2bf3cb19fdaa3fc8646ee4..0b3550fbd51cc8aa7e08ac4d2f6c86cbd7d79579 100644 (file)
@@ -14,6 +14,7 @@
 package org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph;
 
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.jdt.annotation.NonNull;
@@ -28,6 +29,7 @@ import org.eclipse.tracecompass.tmf.analysis.xml.core.model.readonly.TmfXmlReadO
 import org.eclipse.tracecompass.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
 import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
 import org.w3c.dom.Element;
 
@@ -265,4 +267,9 @@ public class XmlEntry extends TimeGraphEntry implements IXmlStateSystemContainer
         return Collections.EMPTY_SET;
     }
 
+    @Override
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
+        return super.getTimeEventsIterator();
+    }
+
 }
index 967a14477b7bcc7e8f2ebc662fd4502934bc9af5..341c3aaa5ad987f1d078893887ffc0aa0208f50a 100644 (file)
@@ -19,10 +19,10 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.util.Collection;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
@@ -38,21 +38,21 @@ public class TmfEventTypeTest {
     // Variables
     // ------------------------------------------------------------------------
 
-    private final String fTypeId1 = "Some type";
-    private final String fTypeId2 = "Some other type";
+    private final @NonNull String fTypeId1 = "Some type";
+    private final @NonNull String fTypeId2 = "Some other type";
 
-    private final String fLabel0 = "label1";
-    private final String fLabel1 = "label2";
-    private final String fLabel2 = "label3";
+    private final @NonNull String fLabel0 = "label1";
+    private final @NonNull String fLabel1 = "label2";
+    private final @NonNull String fLabel2 = "label3";
 
     private final String[] fLabels0 = new String[] { };
     private final String[] fLabels1 = new String[] { fLabel0, fLabel1 };
     private final String[] fLabels2 = new String[] { fLabel1, fLabel0, fLabel2 };
 
-    private final ITmfEventType fType0 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels0));
-    private final ITmfEventType fType1 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
-    private final ITmfEventType fType2 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels2));
-    private final ITmfEventType fType3 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
+    private final @NonNull ITmfEventType fType0 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels0));
+    private final @NonNull ITmfEventType fType1 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
+    private final @NonNull ITmfEventType fType2 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels2));
+    private final @NonNull ITmfEventType fType3 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -90,11 +90,6 @@ public class TmfEventTypeTest {
         assertArrayEquals(fLabels2, labels2.toArray(new String[labels2.size()]));
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testConstructorCornerCases() {
-        new TmfEventType(null, null);
-    }
-
     @Test
     public void testCopyConstructor() {
         final TmfEventType original = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels1));
@@ -107,15 +102,6 @@ public class TmfEventTypeTest {
         assertArrayEquals(fLabels1, labels1.toArray(new String[labels1.size()]));
     }
 
-    @Test
-    public void testCopyConstructorCornerCases() {
-        try {
-            new TmfEventType(null);
-            fail("TmfEventType: null argument");
-        } catch (final IllegalArgumentException e) {
-        }
-    }
-
     // ------------------------------------------------------------------------
     // hashCode
     // ------------------------------------------------------------------------
index 15e81e6cbe5b9bdbe51a9a5a4c7cdb0c850e3b07..ac380039926eb2995e8a317d1dd726cec0563b57 100644 (file)
@@ -24,8 +24,10 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.tmf.core.synchronization.SyncAlgorithmFullyIncremental;
 import org.eclipse.tracecompass.tmf.core.event.matching.TmfEventDependency;
 import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
@@ -49,7 +51,7 @@ import org.junit.Test;
 public class SyncTest {
 
     private TmfTraceStub t1, t2;
-    private Collection<ITmfTrace> fTraces;
+    private @NonNull Collection<ITmfTrace> fTraces = Collections.EMPTY_LIST;
 
     /**
      * Initializing the traces
index 45a8308ccaa54a2d78e25a99e8d202fc2239f754..a94670ce30f67953a4778b2b269b21199f7617ee 100644 (file)
@@ -16,6 +16,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.statesystem.core.AttributeTree;
 import org.eclipse.tracecompass.internal.statesystem.core.StateSystem;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
@@ -77,7 +78,7 @@ public class PartialStateSystem extends StateSystem {
     // ------------------------------------------------------------------------
 
     @Override
-    public void replaceOngoingState(List<ITmfStateInterval> ongoingIntervals) {
+    public void replaceOngoingState(List<@NonNull ITmfStateInterval> ongoingIntervals) {
         super.replaceOngoingState(ongoingIntervals);
     }
 
index 6899bef895a0a800beba544a3f2933549b3def57..5fbd9fd0d7c74a93bd8ca77893887706a42c6eb6 100644 (file)
@@ -42,7 +42,7 @@ import com.google.common.collect.Multimap;
 @NonNullByDefault
 public class TmfAnalysisManager {
 
-    private static final Multimap<String, IAnalysisModuleHelper> fAnalysisModules = NonNullUtils.checkNotNull(HashMultimap.<String, IAnalysisModuleHelper> create());
+    private static final Multimap<String, IAnalysisModuleHelper> fAnalysisModules = NonNullUtils.checkNotNull(HashMultimap.create());
     private static final Map<String, List<Class<? extends IAnalysisParameterProvider>>> fParameterProviders = new HashMap<>();
     private static final Map<Class<? extends IAnalysisParameterProvider>, IAnalysisParameterProvider> fParamProviderInstances = new HashMap<>();
     private static final List<IAnalysisModuleSource> fSources = new ArrayList<>();
index a9b7d2205067402107385d8c989b02f37241ae1c..b8046f48af2f0779f6867d10d5af785e479c616d 100644 (file)
@@ -64,7 +64,7 @@ public interface ITmfEventField {
      *
      * @return The subfield names (empty Collection if none)
      */
-    @NonNull Collection<String> getFieldNames();
+    @NonNull Collection<@NonNull String> getFieldNames();
 
     /**
      * Return the subfields. The iteration order is the same as
index f4096c92943f1a572981b23ac05e8568da414a1d..3292302c03f391b1dd850787b4eba96b4c2c0eee 100644 (file)
@@ -14,6 +14,8 @@ package org.eclipse.tracecompass.tmf.core.event;
 
 import java.util.Collection;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 /**
  * The generic event type in TMF. It contains a reference to the full field structure
  * for that event type.
@@ -35,7 +37,7 @@ public interface ITmfEventType {
     /**
      * The default event type name
      */
-    String DEFAULT_TYPE_ID = "TmfType"; //$NON-NLS-1$
+    @NonNull String DEFAULT_TYPE_ID = "TmfType"; //$NON-NLS-1$
 
     // ------------------------------------------------------------------------
     // Getters
@@ -44,7 +46,7 @@ public interface ITmfEventType {
     /**
      * @return the event type ID
      */
-    String getName();
+    @NonNull String getName();
 
     /**
      * @return the event type root field
index 08a4e22f7207a2b6f8409f9e92f364273cbe3fa7..428fc1c4f72b0f3bd8b3c6a664b46ad848b4f8dd 100644 (file)
@@ -16,6 +16,8 @@ package org.eclipse.tracecompass.tmf.core.event;
 import java.util.Collection;
 import java.util.Collections;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 /**
  * A basic implementation of ITmfEventType.
  *
@@ -31,7 +33,7 @@ public class TmfEventType implements ITmfEventType {
     // Attributes
     // ------------------------------------------------------------------------
 
-    private final String fTypeId;
+    private final @NonNull String fTypeId;
     private final ITmfEventField fRootField;
 
     // ------------------------------------------------------------------------
@@ -51,10 +53,7 @@ public class TmfEventType implements ITmfEventType {
      * @param typeId the type name
      * @param root the root field
      */
-    public TmfEventType(final String typeId, final ITmfEventField root) {
-        if (typeId == null) {
-            throw new IllegalArgumentException();
-        }
+    public TmfEventType(final @NonNull String typeId, final ITmfEventField root) {
         fTypeId = typeId;
         fRootField = root;
     }
@@ -64,10 +63,7 @@ public class TmfEventType implements ITmfEventType {
      *
      * @param type the other type
      */
-    public TmfEventType(final ITmfEventType type) {
-        if (type == null) {
-            throw new IllegalArgumentException();
-        }
+    public TmfEventType(@NonNull ITmfEventType type) {
         fTypeId  = type.getName();
         fRootField = type.getRootField();
     }
index 119c8f225c2b36a73bec13f920841707ad47949c..b6366e5eb814ec65369cf434caec0a56b99f18d0 100644 (file)
@@ -12,6 +12,8 @@
 
 package org.eclipse.tracecompass.tmf.core.event.matching;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -50,7 +52,7 @@ public class TmfEventMatching implements ITmfEventMatching {
     /**
      * The array of traces to match
      */
-    private final Collection<ITmfTrace> fTraces;
+    private final @NonNull Collection<@NonNull ITmfTrace> fTraces;
 
     /**
      * The class to call once a match is found
@@ -91,7 +93,7 @@ public class TmfEventMatching implements ITmfEventMatching {
      *            The set of traces for which to match events
      * @since 1.0
      */
-    public TmfEventMatching(Collection<ITmfTrace> traces) {
+    public TmfEventMatching(Collection<@NonNull ITmfTrace> traces) {
         this(traces, new TmfEventMatches());
     }
 
@@ -103,7 +105,7 @@ public class TmfEventMatching implements ITmfEventMatching {
      * @param tmfEventMatches
      *            The match processing class
      */
-    public TmfEventMatching(Collection<ITmfTrace> traces, IMatchProcessingUnit tmfEventMatches) {
+    public TmfEventMatching(Collection<@NonNull ITmfTrace> traces, IMatchProcessingUnit tmfEventMatches) {
         if (tmfEventMatches == null) {
             throw new IllegalArgumentException();
         }
@@ -287,7 +289,7 @@ public class TmfEventMatching implements ITmfEventMatching {
          * lists
          */
         if (found) {
-            getProcessingUnit().addMatch(dep);
+            getProcessingUnit().addMatch(checkNotNull(dep));
             monitor.subTask(NLS.bind(Messages.TmfEventMatching_MatchesFound, getProcessingUnit().countMatches()));
         } else {
             /*
index 56b7ba45a7f38bc103d448cce86559b878eb0e95..01e326072c42865740be5ed1a5db8b5e5984e74c 100644 (file)
@@ -253,7 +253,7 @@ public interface ITmfTrace extends ITmfEventProvider {
      *
      * @return An iterable view of the analysis modules
      */
-    @NonNull Iterable<IAnalysisModule> getAnalysisModules();
+    @NonNull Iterable<@NonNull IAnalysisModule> getAnalysisModules();
 
     // ------------------------------------------------------------------------
     // Aspect getters
@@ -267,7 +267,7 @@ public interface ITmfTrace extends ITmfEventProvider {
      *
      * @return The event aspects for this trace
      */
-    @NonNull Iterable<ITmfEventAspect> getEventAspects();
+    @NonNull Iterable<@NonNull ITmfEventAspect> getEventAspects();
 
     // ------------------------------------------------------------------------
     // Trace characteristics getters
index b57ac4045e62be17872051cf91110eb94e890047..13cb6510c2365e14cdd4b9b0849adf665eae3168 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.tracecompass.tmf.core.trace;
 
 import java.util.Set;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
 
 /**
@@ -31,6 +32,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
  * @author Geneviève Bastien
  * @author Matthew Khouzam
  */
+@NonNullByDefault
 public interface ITmfTraceWithPreDefinedEvents {
 
     /**
index 7adfc0c0ff7b39f498262231f564da25a74c7f62..029151210deb53b73a90575b30667680a6e9b191 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.tracecompass.tmf.core.trace;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
 
 /**
@@ -37,8 +38,8 @@ public final class TmfEventTypeCollectionHelper {
      * @return a set of the names of these events, if some names are clashing
      *         they will only appear once
      */
-    public static Set<String> getEventNames(Iterable<? extends ITmfEventType> eventTypes) {
-        Set<String> retSet = new HashSet<>();
+    public static Set<@NonNull String> getEventNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) {
+        Set<@NonNull String> retSet = new HashSet<>();
         for (ITmfEventType eventType : eventTypes) {
             retSet.add(eventType.getName());
         }
index 5295364f9dfd90a179b995d266a4d9ac3ce4daa7..7876c3315fc8f30fce2e93d992cebc6c3867329f 100644 (file)
@@ -100,7 +100,7 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, IT
     /**
      * Basic aspects that should be valid for all trace types.
      */
-    public static final @NonNull Collection<ITmfEventAspect> BASE_ASPECTS =
+    public static final @NonNull Collection<@NonNull ITmfEventAspect> BASE_ASPECTS =
             checkNotNull(ImmutableList.of(
                     ITmfEventAspect.BaseAspects.TIMESTAMP,
                     ITmfEventAspect.BaseAspects.EVENT_TYPE,
index 71bd80d38b5ef7930f13d1723a7922175ce0e0ac..77a43cb0436e02d4919d829a1a14d57213576f7a 100644 (file)
@@ -177,11 +177,11 @@ public final class TmfTraceManager {
      *            The trace or experiment
      * @return The corresponding trace set.
      */
-    public static @NonNull Collection<ITmfTrace> getTraceSet(ITmfTrace trace) {
+    public static @NonNull Collection<@NonNull ITmfTrace> getTraceSet(ITmfTrace trace) {
         if (trace == null) {
-            return NonNullUtils.checkNotNull(ImmutableSet.<ITmfTrace> of());
+            return NonNullUtils.checkNotNull(ImmutableSet.of());
         }
-        List<ITmfTrace> traces = trace.getChildren(ITmfTrace.class);
+        List<@NonNull ITmfTrace> traces = trace.getChildren(ITmfTrace.class);
         if (traces.size() > 0) {
             return NonNullUtils.checkNotNull(ImmutableSet.copyOf(traces));
         }
index fc8baad479886061013b6444027c3bede3800181..aa2c038994504809414b5f5f4c32ee548d1c95a6 100644 (file)
@@ -19,6 +19,7 @@ import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
@@ -72,9 +73,9 @@ public final class TmfTraceUtils {
      *            Returned modules must extend this class
      * @return List of modules of class moduleClass
      */
-    public static <T> Iterable<T> getAnalysisModulesOfClass(ITmfTrace trace, Class<T> moduleClass) {
+    public static <T> Iterable<@NonNull T> getAnalysisModulesOfClass(ITmfTrace trace, Class<T> moduleClass) {
         Iterable<IAnalysisModule> analysisModules = trace.getAnalysisModules();
-        Set<T> modules = new HashSet<>();
+        Set<@NonNull T> modules = new HashSet<>();
         for (IAnalysisModule module : analysisModules) {
             if (moduleClass.isAssignableFrom(module.getClass())) {
                 modules.add(moduleClass.cast(module));
index c3c8d98530a6902fb896bbb0a22e31739dfb8d39..7235a8adc5048f605864ca88b0c2cec069f3cefc 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.internal.tmf.remote.core.shell.CommandInput;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandInput;
 import org.junit.Test;
@@ -30,7 +29,7 @@ import org.junit.Test;
 public class CommandInputTest {
 
     private static final @NonNull String COMMAND = "my-command";
-    private static final String @NonNull [] CMD_INPUT = { "This", "are", "the", "params" };
+    private static final @NonNull String @NonNull [] CMD_INPUT = { "This", "are", "the", "params" };
 
     /**
      * Test suite for the {@link CommandInput#add(String)} and {@link CommandInput#addAll(List)}
@@ -39,8 +38,8 @@ public class CommandInputTest {
     public void testConstructorAndAdd() {
         ICommandInput iunput = new CommandInput();
         iunput.add(COMMAND);
-        List<String> params = Arrays.asList(CMD_INPUT);
-        iunput.addAll(NonNullUtils.checkNotNull(params));
+        @NonNull List<@NonNull String> params = Arrays.asList(CMD_INPUT);
+        iunput.addAll(params);
 
         List<String> expectedList = new ArrayList<>();
         expectedList.add(COMMAND);
index 0cf9974014a184ce7deb146c0e3896561fb71bc7..89ee9a86e8645a99f1a9da4713f0a0f7c6b07bed 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
 
@@ -29,7 +30,7 @@ public class TraceImpl implements ITimeGraphEntry {
     private long startTime = 0;
     private long stopTime = 1;
     private String className = "defaultClassName";
-    private Vector<ITimeEvent> traceEvents = new Vector<>();
+    private Vector<@NonNull ITimeEvent> traceEvents = new Vector<>();
 
     // ========================================================================
     // Constructor
@@ -87,21 +88,21 @@ public class TraceImpl implements ITimeGraphEntry {
     }
 
     @Override
-    public Iterator<ITimeEvent> getTimeEventsIterator() {
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
         return traceEvents.iterator();
     }
 
     @Override
-    public Iterator<ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) {
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) {
         return traceEvents.iterator();
     }
 
-    public void addTraceEvent(ITimeEvent event) {
+    public void addTraceEvent(@NonNull ITimeEvent event) {
         traceEvents.add(event);
     }
 
     @Override
-    public List<ITimeGraphEntry> getChildren() {
+    public List<@NonNull ITimeGraphEntry> getChildren() {
         return null;
     }
 
index 2c2a11b6a6a9876a6303ee4ef96e3477cc81aaff..2a114fafdf8a1e297fc042acc7463c2c9dd03e0f 100644 (file)
@@ -43,8 +43,7 @@ public interface ITmfTreeViewerEntry {
      *
      * @return an array of child elements
      */
-    @NonNull
-    List<? extends ITmfTreeViewerEntry> getChildren();
+    @NonNull List<@NonNull ? extends ITmfTreeViewerEntry> getChildren();
 
     /**
      * Returns the name of this entry.
index ff4ce3a49da7fda0d7a45f977a228b992ec50d96..65cb795a2cccb56ffbc91de053570ba20e35a593 100644 (file)
@@ -28,8 +28,7 @@ public class TmfTreeViewerEntry implements ITmfTreeViewerEntry {
     private ITmfTreeViewerEntry fParent = null;
 
     /** List of child entries */
-    @NonNull
-    private final List<ITmfTreeViewerEntry> fChildren = new CopyOnWriteArrayList<>();
+    private final @NonNull List<@NonNull ITmfTreeViewerEntry> fChildren = new CopyOnWriteArrayList<>();
 
     /** Name of this entry (default text to show in first column) */
     private String fName;
@@ -68,7 +67,7 @@ public class TmfTreeViewerEntry implements ITmfTreeViewerEntry {
     }
 
     @Override
-    public List<ITmfTreeViewerEntry> getChildren() {
+    public List<@NonNull ITmfTreeViewerEntry> getChildren() {
         return fChildren;
     }
 
index f980f076bb00dbc22cc6422b30e6565bf5435a3f..fde4c706dfad7e2975cfe7ce36144e9afb64f40e 100644 (file)
 
 package org.eclipse.tracecompass.tmf.ui.views.timechart;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Vector;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
@@ -43,7 +46,7 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
     }
 
     @Override
-    public List<ITimeGraphEntry> getChildren() {
+    public List<@NonNull ITimeGraphEntry> getChildren() {
         return null;
     }
 
@@ -78,16 +81,16 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
     }
 
     @Override
-    public Iterator<ITimeEvent> getTimeEventsIterator() {
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
         return new EntryIterator(0, Long.MAX_VALUE, 0);
     }
 
     @Override
-    public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long maxDuration) {
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long maxDuration) {
         return new EntryIterator(startTime, stopTime, maxDuration);
     }
 
-    private class EntryIterator implements Iterator<ITimeEvent> {
+    private class EntryIterator implements Iterator<@NonNull ITimeEvent> {
         private final long fIteratorStartTime;
         private final long fIteratorStopTime;
         private final long fIteratorMaxDuration;
@@ -142,7 +145,7 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry {
                     return event;
                 }
                 if (hasNext()) {
-                    TimeChartEvent event = next;
+                    TimeChartEvent event = checkNotNull(next);
                     next = null;
                     return event;
                 }
index ac964f1711c19d6047cd3759f3740fd8bd1d30bf..ad5427e9fd050fdfdc8f5c31dd882e59b5e932ea 100644 (file)
 
 package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 
 /**
  * An iterator for time events. Events from the zoomed event list override any
@@ -31,7 +35,7 @@ import java.util.NoSuchElementException;
  * iterator    [A][D][E][F]       [G][B][C]
  * </pre>
  */
-public class EventIterator implements Iterator<ITimeEvent> {
+public class EventIterator implements Iterator<@NonNull ITimeEvent> {
 
     private final long fStartTime;
     private final long fEndTime;
@@ -139,11 +143,11 @@ public class EventIterator implements Iterator<ITimeEvent> {
     public ITimeEvent next() {
         if (hasNext()) {
             if (fZoomedNext != null && (fNext == null || fZoomedNext.getTime() <= fNext.getTime())) {
-                ITimeEvent event = fZoomedNext;
+                ITimeEvent event = checkNotNull(fZoomedNext);
                 fZoomedNext = null;
                 return event;
             }
-            ITimeEvent event = fNext;
+            ITimeEvent event = checkNotNull(fNext);
             fNext = fSplitNext;
             fSplitNext = null;
             return event;
index f5f662c3ec896375fac932f846dee2c4dd209779..cf94fbd82368728b285a4488786627809934accc 100644 (file)
@@ -16,6 +16,8 @@ package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model;
 import java.util.Iterator;
 import java.util.List;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 /**
  * Interface for an entry (row) in the time graph view
  *
@@ -44,7 +46,7 @@ public interface ITimeGraphEntry {
      *
      * @return an array of child elements
      */
-    List<? extends ITimeGraphEntry> getChildren();
+    List<@NonNull ? extends ITimeGraphEntry> getChildren();
 
     /**
      * Returns the name of this entry.
@@ -83,18 +85,22 @@ public interface ITimeGraphEntry {
      *
      * @return the iterator
      */
-    <T extends ITimeEvent> Iterator<T> getTimeEventsIterator();
+    Iterator<@NonNull ? extends ITimeEvent> getTimeEventsIterator();
 
     /**
-     * Get an iterator which only returns events that fall within the start time and the stop time.
-     * The visible duration is the event duration below which further detail is not discernible.
-     * If no such iterator is implemented, provide a basic iterator which returns all events.
+     * Get an iterator which only returns events that fall within the start time
+     * and the stop time. The visible duration is the event duration below which
+     * further detail is not discernible. If no such iterator is implemented,
+     * provide a basic iterator which returns all events.
      *
-     * @param startTime start time in nanoseconds
-     * @param stopTime stop time in nanoseconds
-     * @param visibleDuration duration of one pixel in nanoseconds
+     * @param startTime
+     *            start time in nanoseconds
+     * @param stopTime
+     *            stop time in nanoseconds
+     * @param visibleDuration
+     *            duration of one pixel in nanoseconds
      *
      * @return the iterator
      */
-    <T extends ITimeEvent> Iterator<T> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration);
+    <T extends ITimeEvent> Iterator<@NonNull T> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration);
 }
index 77ef43cf2c83521007f33ecf5a4f567193f1df9b..f5289745149daece368768d6b2cc786fdafc0783 100644 (file)
@@ -32,7 +32,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
     private ITimeGraphEntry fParent = null;
 
     /** List of child entries */
-    private final List<ITimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
+    private final List<@NonNull ITimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
 
     /** Name of this entry (text to show) */
     private String fName;
@@ -97,7 +97,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
     }
 
     @Override
-    public synchronized List<? extends ITimeGraphEntry> getChildren() {
+    public synchronized List<@NonNull ? extends ITimeGraphEntry> getChildren() {
         return fChildren;
     }
 
@@ -142,7 +142,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
     }
 
     @Override
-    public Iterator<ITimeEvent> getTimeEventsIterator() {
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
         if (hasTimeEvents()) {
             return new EventIterator(fEventList, fZoomedEventList);
         }
@@ -150,7 +150,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
     }
 
     @Override
-    public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
+    public Iterator<@NonNull ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
         if (!hasTimeEvents()) {
             return null;
         }
@@ -258,7 +258,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
     /*
      * TODO: This method can be removed in the next major API version.
      */
-    public synchronized void addChild(TimeGraphEntry child) {
+    public synchronized void addChild(@NonNull TimeGraphEntry child) {
         addChild((ITimeGraphEntry) child);
     }
 
@@ -270,7 +270,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
      * @param child
      *            The child entry
      */
-    public synchronized void addChild(ITimeGraphEntry child) {
+    public synchronized void addChild(@NonNull ITimeGraphEntry child) {
         /*
          * TODO: Use setParent() once it is added to the interface.
          */
@@ -299,7 +299,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
      * @param child
      *            The child entry
      */
-    public synchronized void addChild(int index, ITimeGraphEntry child) {
+    public synchronized void addChild(int index, @NonNull ITimeGraphEntry child) {
         /*
          * TODO: Use setParent() once it is added to the interface.
          */
@@ -322,7 +322,7 @@ public class TimeGraphEntry implements ITimeGraphEntry {
         if (comparator == null) {
             return;
         }
-        ITimeGraphEntry[] array = fChildren.toArray(new ITimeGraphEntry[0]);
+        @NonNull ITimeGraphEntry[] array = fChildren.toArray(new @NonNull ITimeGraphEntry[0]);
         Arrays.sort(array, comparator);
         fChildren.clear();
         fChildren.addAll(Arrays.asList(array));
index 720fc8d1f812f427fe2eff988a713a140a49929d..94d2cf6f7dc0d169ea668d3db0a761e7986b6a2e 100644 (file)
@@ -524,7 +524,7 @@ public class Utils {
         if (null == entry || ! entry.hasTimeEvents()) {
             return null;
         }
-        Iterator<ITimeEvent> iterator = entry.getTimeEventsIterator();
+        Iterator<? extends ITimeEvent> iterator = entry.getTimeEventsIterator();
         if (iterator != null && iterator.hasNext()) {
             return iterator.next();
         }
@@ -550,7 +550,7 @@ public class Utils {
         if (null == entry || ! entry.hasTimeEvents()) {
             return null;
         }
-        Iterator<ITimeEvent> iterator = entry.getTimeEventsIterator();
+        Iterator<? extends ITimeEvent> iterator = entry.getTimeEventsIterator();
         if (iterator == null) {
             return null;
         }
This page took 0.063317 seconds and 5 git commands to generate.