Fix latest batch of null warnings
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Sun, 29 Nov 2015 04:45:42 +0000 (23:45 -0500)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Thu, 10 Dec 2015 18:44:35 +0000 (13:44 -0500)
2f79cfb was about fixing the errors that cropped up with the new
version of JDT. This latest patch fixes the related warnings.

It introduces external @NonNull annotations to the following
methods in Guava's Multimap:

get()
keySet()
values()

The last two follow the same reasoning as the corresponding Map
methods. The first one, get(), may seem surprising. But Multimap's
get() is really @NonNull, it will at most return an empty Collection
if there are no values in the map matching the passed key.

Change-Id: Ie8dccff9491a8c0200b503ad76fd44092eb975e2
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/61929
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
29 files changed:
analysis/org.eclipse.tracecompass.analysis.graph.ui/src/org/eclipse/tracecompass/internal/analysis/graph/ui/criticalpath/view/CriticalPathView.java
common/org.eclipse.tracecompass.common.core/annotations/com/google/common/collect/Multimap.eea [new file with mode: 0644]
common/org.eclipse.tracecompass.common.core/annotations/org/eclipse/core/resources/IMarkerDelta.eea [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/EventDefinition.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ICompositeDefinition.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDeclaration.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDefinition.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/StructDeclarationFlattener.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderDefinition.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfEventFieldTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfEvent.java
lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/AssignEventHandler.java
lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
statesystem/org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/backend/HistoryTreeTest.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/Attribute.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTree.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/analysis/AnalysisManagerTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfExperimentUtilsTest.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/analysis/TmfAnalysisModuleSourceConfigElement.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfContentFieldAspect.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/project/model/TraceTypeHelper.java
tmf/org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/internal/tmf/remote/core/shell/CommandInput.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/editors/TmfEventsEditor.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/ShowFilterDialogAction.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java

index cbd7306149171025da4d5e0f4634004e86d67098..8af721017e92798df8b7f13c4f325b3bdf02e5e4 100644 (file)
@@ -228,7 +228,7 @@ public class CriticalPathView extends AbstractTimeGraphView {
 
             return (entries == null) ?
                 new ITimeGraphEntry[0] :
-                NonNullUtils.checkNotNull(entries.toArray(new ITimeGraphEntry[entries.size()]));
+                entries.toArray(new @NonNull ITimeGraphEntry[entries.size()]);
         }
 
         private void buildEntryList(IGraphWorker worker) {
diff --git a/common/org.eclipse.tracecompass.common.core/annotations/com/google/common/collect/Multimap.eea b/common/org.eclipse.tracecompass.common.core/annotations/com/google/common/collect/Multimap.eea
new file mode 100644 (file)
index 0000000..ea2fdba
--- /dev/null
@@ -0,0 +1,10 @@
+class com/google/common/collect/Multimap
+get
+ (TK;)Ljava/util/Collection<TV;>;
+ (TK;)L1java/util/Collection<TV;>;
+keySet
+ ()Ljava/util/Set<TK;>;
+ ()L1java/util/Set<TK;>;
+values
+ ()Ljava/util/Collection<TV;>;
+ ()L1java/util/Collection<TV;>;
diff --git a/common/org.eclipse.tracecompass.common.core/annotations/org/eclipse/core/resources/IMarkerDelta.eea b/common/org.eclipse.tracecompass.common.core/annotations/org/eclipse/core/resources/IMarkerDelta.eea
new file mode 100644 (file)
index 0000000..b41c061
--- /dev/null
@@ -0,0 +1,4 @@
+class org/eclipse/core/resources/IMarkerDelta
+getMarker
+ ()Lorg/eclipse/core/resources/IMarker;
+ ()L1org/eclipse/core/resources/IMarker;
index 68cb58948b19b87bc2cc336faff226f34b5a8cf6..2f1003cf4593ff26acb8364d4b8cc63da8bbdc00 100644 (file)
@@ -208,7 +208,7 @@ public final class EventDefinition implements IDefinitionScope {
         List<Definition> fieldValues = new ArrayList<>();
 
         /* Add fields from the stream */
-        List<String> fieldNames = fStreamContext.getFieldNames();
+        List<@NonNull String> fieldNames = fStreamContext.getFieldNames();
         for (String fieldName : fieldNames) {
             Definition definition = fStreamContext.getDefinition(fieldName);
             mergedDeclaration.addField(fieldName, definition.getDeclaration());
index a459ac3da50c8cd334627113f93bb097584d3587..302bbda0913e6b399d6cec88f23ebfbcd9da257a 100644 (file)
@@ -14,6 +14,8 @@ package org.eclipse.tracecompass.ctf.core.event.types;
 
 import java.util.List;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 /**
  * Interface for data definitions containing heterogenous definitions
  * (subfields)
@@ -36,6 +38,6 @@ public interface ICompositeDefinition extends IDefinition {
      *
      * @return the field names array
      */
-    List<String> getFieldNames();
+    List<@NonNull String> getFieldNames();
 
 }
index d612dd77aa10a9a0cbb3487e69f1db2535bc24e0..1376e4107926874ae3d5b04d4f5503f8aeeb2df8 100644 (file)
@@ -47,7 +47,7 @@ public class StructDeclaration extends Declaration {
     // ------------------------------------------------------------------------
 
     /** linked list of field names. So fieldName->fieldValue */
-    private final @NonNull Map<String, IDeclaration> fFieldMap = new LinkedHashMap<>();
+    private final @NonNull Map<@NonNull String, IDeclaration> fFieldMap = new LinkedHashMap<>();
 
     /** maximum bit alignment */
     private long fMaxAlign;
@@ -119,7 +119,7 @@ public class StructDeclaration extends Declaration {
      *
      * @return the field list.
      */
-    public Iterable<String> getFieldsList() {
+    public @NonNull Iterable<@NonNull String> getFieldsList() {
         return fFieldMap.keySet();
     }
 
@@ -193,7 +193,7 @@ public class StructDeclaration extends Declaration {
      * @param declaration
      *            the declaration of the field
      */
-    public void addField(String name, IDeclaration declaration) {
+    public void addField(@NonNull String name, IDeclaration declaration) {
         fFieldMap.put(name, declaration);
         fMaxAlign = Math.max(fMaxAlign, declaration.getAlignment());
     }
index c614d00e4ecc123def5d8a5d1d889091d6cbcfad..48e85e6eb0e78512079add30f914ee6d41a0a424 100644 (file)
@@ -46,7 +46,7 @@ public final class StructDefinition extends ScopedDefinition implements IComposi
     // Attributes
     // ------------------------------------------------------------------------
 
-    private final @NonNull List<String> fFieldNames;
+    private final @NonNull List<@NonNull String> fFieldNames;
     private final Definition[] fDefinitions;
     private Map<String, Definition> fDefinitionsMap = null;
 
@@ -98,8 +98,11 @@ public final class StructDefinition extends ScopedDefinition implements IComposi
      * @since 1.0
      */
     public StructDefinition(@NonNull StructDeclaration declaration,
-            IDefinitionScope definitionScope, @NonNull ILexicalScope scope,
-            @NonNull String structFieldName, @NonNull Iterable<String> fieldNames, Definition[] definitions) {
+            IDefinitionScope definitionScope,
+            @NonNull ILexicalScope scope,
+            @NonNull String structFieldName,
+            @NonNull Iterable<@NonNull String> fieldNames,
+            Definition[] definitions) {
         super(declaration, definitionScope, structFieldName, scope);
         fFieldNames = ImmutableList.copyOf(fieldNames);
         fDefinitions = definitions;
@@ -128,7 +131,7 @@ public final class StructDefinition extends ScopedDefinition implements IComposi
     }
 
     @Override
-    public @NonNull List<String> getFieldNames() {
+    public @NonNull List<@NonNull String> getFieldNames() {
         return fFieldNames;
     }
 
index 0981f0b8c6fc4f5c51402e5c68f2f419454f7877..aff5a7cb074a7a22893a745817e829c6111e800e 100644 (file)
@@ -85,7 +85,7 @@ public final class StructDeclarationFlattener {
         return flatStruct;
     }
 
-    private static void depthFirstAdd(String path, StructDeclaration flatStruct, IDeclaration dec) {
+    private static void depthFirstAdd(@NonNull String path, StructDeclaration flatStruct, IDeclaration dec) {
         if (dec instanceof ISimpleDatatypeDeclaration) {
             flatStruct.addField(path, dec);
         } else if (dec instanceof ArrayDeclaration) {
index f98ad6682ac99be21a479581c4bfaa7ed75bbf9d..ff0841353c7dabd17be36e2efca68deb94ebddc5 100644 (file)
@@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableList;
  */
 public final class EventHeaderDefinition extends Definition implements ICompositeDefinition {
 
-    private static final @NonNull List<String> FIELD_NAMES = ImmutableList.of(
+    private static final @NonNull List<@NonNull String> FIELD_NAMES = ImmutableList.of(
             IEventHeaderDeclaration.ID,
             IEventHeaderDeclaration.TIMESTAMP
             );
@@ -99,7 +99,7 @@ public final class EventHeaderDefinition extends Definition implements IComposit
     }
 
     @Override
-    public @NonNull List<String> getFieldNames() {
+    public @NonNull List<@NonNull String> getFieldNames() {
         return FIELD_NAMES;
     }
-}
\ No newline at end of file
+}
index a0f77b70a12864fa725f75c39aa7a6d8832358b2..78f34bbb30f169b873ea479493d2c40b0642a998 100644 (file)
@@ -49,24 +49,24 @@ import org.junit.Test;
 public class CtfTmfEventFieldTest {
 
     private static final @NonNull String ROOT = "root";
-    private static final String SEQ = "seq";
+    private static final @NonNull String SEQ = "seq";
     private static final @NonNull String ARRAY_STR = "array_str";
     private static final @NonNull String ARRAY_FLOAT = "array_float";
     private static final @NonNull String ARRAY_INT = "array_int";
     private static final @NonNull String ARRAY_STRUCT = "array_struct";
     private static final @NonNull String ARRAY_VARIANT = "array_variant";
     private static final @NonNull String ARRAY_ENUM = "array_enum";
-    private static final String STR = "str";
-    private static final String FLOAT = "float";
-    private static final String LEN = "len";
-    private static final String INT = "int";
+    private static final @NonNull String STR = "str";
+    private static final @NonNull String FLOAT = "float";
+    private static final @NonNull String LEN = "len";
+    private static final @NonNull String INT = "int";
     private static final @NonNull String NAME = "test";
-    private static final String STRUCT = "struct";
-    private static final String VARIANT = "variant";
-    private static final String ENUM = "enum";
+    private static final @NonNull String STRUCT = "struct";
+    private static final @NonNull String VARIANT = "variant";
+    private static final @NonNull String ENUM = "enum";
 
     private static final byte TEST_NUMBER = 2;
-    private static final String TEST_STRING = "two";
+    private static final @NonNull String TEST_STRING = "two";
 
     private static final int ARRAY_SIZE = 2;
 
index 6c1688300d862047bb8960f7e36be34bbc973bfd..a856e0835807e26ef8f1de1a8832db509dc483c0 100644 (file)
@@ -20,6 +20,7 @@ import java.util.HashSet;
 import java.util.List;
 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.ctf.core.event.EventDefinition;
@@ -280,7 +281,7 @@ public class CtfTmfEvent extends TmfEvent
             }
         }
 
-        return checkNotNull(fields.toArray(new CtfTmfEventField[fields.size()]));
+        return checkNotNull(fields.toArray(new @NonNull CtfTmfEventField[fields.size()]));
     }
 
     // ------------------------------------------------------------------------
index 45ee3264bc55ede79fd3b3c001d0f187a68eb871..baab209b15bf56b16df28bc43942cbfdc3f379e4 100644 (file)
@@ -139,7 +139,7 @@ public class AssignEventHandler extends BaseControlViewHandler {
     @Override
     public boolean isEnabled() {
         @NonNull ArrayList<@NonNull BaseEventComponent> events = new ArrayList<>();
-        TraceSessionComponent[] sessions = null;
+        @NonNull TraceSessionComponent[] sessions = null;
         Boolean isKernel = null;
 
         // Get workbench page for the Control View
@@ -221,7 +221,7 @@ public class AssignEventHandler extends BaseControlViewHandler {
         /**
          * The list of available sessions.
          */
-        private final TraceSessionComponent[] fSessions;
+        private final @NonNull TraceSessionComponent[] fSessions;
 
         /**
          * Flag for indicating Kernel or UST.
@@ -235,7 +235,7 @@ public class AssignEventHandler extends BaseControlViewHandler {
          * @param events - a lists of events to enable
          * @param isKernel - domain (true for kernel or UST)
          */
-        public Parameter(TraceSessionComponent[] sessions, List<BaseEventComponent> events, boolean isKernel) {
+        public Parameter(@NonNull TraceSessionComponent[] sessions, List<BaseEventComponent> events, boolean isKernel) {
             fSessions = NonNullUtils.checkNotNull(Arrays.copyOf(sessions, sessions.length));
             fEvents = new ArrayList<>();
             fEvents.addAll(events);
index f9c755d31c2afcbcc6ff5d7cd5f3a850f815c901..b63979ccec74578be31e3a32e747d3abed2158df 100644 (file)
@@ -199,12 +199,12 @@ public class TargetNodeComponent extends TraceControlComponent implements IRemot
     /**
      * @return all available sessions.
      */
-    public TraceSessionComponent[] getSessions() {
+    public @NonNull TraceSessionComponent[] getSessions() {
         List<ITraceControlComponent> compenents = getChildren(TraceSessionGroup.class);
         if (compenents.size() > 0) {
             TraceSessionGroup group = (TraceSessionGroup)compenents.get(0);
             List<ITraceControlComponent> sessions = group.getChildren(TraceSessionComponent.class);
-            return sessions.toArray(new TraceSessionComponent[sessions.size()]);
+            return sessions.toArray(new @NonNull TraceSessionComponent[sessions.size()]);
         }
         return new TraceSessionComponent[0];
     }
index 6c1ea9b717d0ed8d42fae40af50d3117db2f6739..1021f0d7bcb410a8ce8179f9e3ea525e20ab7e12 100644 (file)
@@ -16,6 +16,7 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTConfig;
 import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTInterval;
 import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTNode;
@@ -42,9 +43,9 @@ public class HistoryTreeTest {
 
     /* String with 23 characters, interval in file will be 25 bytes long */
     private static final String TEST_STRING = "abcdefghifklmnopqrstuvw";
-    private static final TmfStateValue STRING_VALUE = TmfStateValue.newValueString(TEST_STRING);
-    private static final TmfStateValue LONG_VALUE = TmfStateValue.newValueLong(10L);
-    private static final TmfStateValue INT_VALUE = TmfStateValue.newValueInt(1);
+    private static final @NonNull TmfStateValue STRING_VALUE = TmfStateValue.newValueString(TEST_STRING);
+    private static final @NonNull TmfStateValue LONG_VALUE = TmfStateValue.newValueLong(10L);
+    private static final @NonNull TmfStateValue INT_VALUE = TmfStateValue.newValueInt(1);
 
     private File fTempFile;
 
@@ -88,7 +89,7 @@ public class HistoryTreeTest {
         return ht;
     }
 
-    private static long fillValues(HistoryTree ht, TmfStateValue value, int nbValues, long start) {
+    private static long fillValues(HistoryTree ht, @NonNull TmfStateValue value, int nbValues, long start) {
         for (int i = 0; i < nbValues; i++) {
             ht.insertInterval(new HTInterval(start + i, start + i + 1, 1, value));
         }
index 2ea13f74b3adc6fb83bea2f5f4ac060a51d4dce3..0fe8418bda6e02089d886bb7843ed43424603939 100644 (file)
@@ -208,7 +208,7 @@ public final class Attribute {
             curNode = curNode.parent;
         }
 
-        return checkNotNull(list.toArray(new String[0]));
+        return list.toArray(new String[0]);
     }
 
     /**
index d8f25d4dedb4df83a76f979ef0d17657217bd4ee..67d6a1f1d4e5a9aaae1edd29d084166d6a5c2ab3 100644 (file)
@@ -74,7 +74,7 @@ public class HistoryTree {
     private int fNodeCount;
 
     /** "Cache" to keep the active nodes in memory */
-    private final List<@NonNull HTNode> fLatestBranch;
+    private final @NonNull List<@NonNull HTNode> fLatestBranch;
 
     // ------------------------------------------------------------------------
     // Constructors/"Destructors"
@@ -217,7 +217,7 @@ public class HistoryTree {
      *            start
      * @throws ClosedChannelException
      */
-    private List<@NonNull HTNode> buildLatestBranch(int rootNodeSeqNb) throws ClosedChannelException {
+    private @NonNull List<@NonNull HTNode> buildLatestBranch(int rootNodeSeqNb) throws ClosedChannelException {
         List<@NonNull HTNode> list = new ArrayList<>();
 
         HTNode nextChildNode = fTreeIO.readNode(rootNodeSeqNb);
index 5c34e36883656c0d591bbfb18ea7d69f02ecf9ac..48235bc272571d841bba7589fdf72bdac7853969 100644 (file)
@@ -95,7 +95,7 @@ public class AnalysisManagerTest {
     public void testListForTraces() {
         /* Generic TmfTrace */
         ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace();
-        Class<? extends ITmfTrace> traceClass = trace.getClass();
+        Class<@NonNull ? extends ITmfTrace> traceClass = trace.getClass();
         assertNotNull(traceClass);
         Map<String, IAnalysisModuleHelper> map = TmfAnalysisManager.getAnalysisModules(traceClass);
 
@@ -121,14 +121,14 @@ public class AnalysisManagerTest {
         /* Make sure that modules in the new source are not in the list already */
         /* Generic TmfTrace */
         ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace();
-        Class<? extends ITmfTrace> traceClass = trace.getClass();
+        Class<@NonNull ? extends ITmfTrace> traceClass = trace.getClass();
         assertNotNull(traceClass);
         Map<String, IAnalysisModuleHelper> map = TmfAnalysisManager.getAnalysisModules(traceClass);
 
         assertFalse(map.containsKey(AnalysisModuleTestHelper.moduleStubEnum.TEST.name()));
 
         /* TmfTraceStub2 class */
-        Class<? extends ITmfTrace> ftraceClass = fTrace.getClass();
+        Class<@NonNull ? extends ITmfTrace> ftraceClass = fTrace.getClass();
         assertNotNull(ftraceClass);
         map = TmfAnalysisManager.getAnalysisModules(ftraceClass);
 
index ac880fba716a56c136d42624082e255e2ea8d425..cd803601dc78d8b19ee3daa01eb0714a5c0e3811 100644 (file)
@@ -16,6 +16,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
@@ -116,8 +117,8 @@ public class TmfExperimentUtilsTest {
      */
     @Test
     public void testGetModuleByClass() {
-        Class<TestAnalysis> commonClass = TestAnalysis.class;
-        Class<TestAnalysis2> notCommonClass = TestAnalysis2.class;
+        Class<@NonNull TestAnalysis> commonClass = TestAnalysis.class;
+        Class<@NonNull TestAnalysis2> notCommonClass = TestAnalysis2.class;
         String host1 = TmfTestTrace.A_TEST_10K.getPath();
         String host2 = TmfTestTrace.A_TEST_10K2.getPath();
         TmfExperiment experiment = fExperiment;
index 52a10b64c38cc39d88b83eb5cccfbda08752d3df..5bde392e8ccd25c3168c68bd49e1c21c5bc62f06 100644 (file)
@@ -20,6 +20,7 @@ import java.util.List;
 
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleHelper;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleSource;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisModuleHelperConfigElement;
@@ -91,7 +92,7 @@ public final class TmfAnalysisModuleSourceConfigElement implements IAnalysisModu
                 typeElements.add(element);
             }
         }
-        return checkNotNull(typeElements.toArray(new IConfigurationElement[typeElements.size()]));
+        return checkNotNull(typeElements.toArray(new @NonNull IConfigurationElement[typeElements.size()]));
     }
 
     /**
index 991112c308cccfd6f8b3cd14708c61bd015dd7a2..7f5b7a11943438c6ca37b9e9d5394ea69ab74ff6 100644 (file)
@@ -17,6 +17,7 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
 import java.util.Arrays;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
@@ -41,11 +42,11 @@ public class TmfContentFieldAspect implements ITmfEventAspect {
      *            The field name or absolute field path array to look for in the
      *            event content. Should *not* be localized!
      */
-    public TmfContentFieldAspect(String aspectName, String... fieldPath) {
+    public TmfContentFieldAspect(String aspectName, @NonNull String... fieldPath) {
         this(aspectName, EMPTY_STRING, fieldPath);
     }
 
-    private TmfContentFieldAspect(String aspectName, String helpText, String... fieldPath) {
+    private TmfContentFieldAspect(String aspectName, String helpText, @NonNull String... fieldPath) {
         fAspectName = aspectName;
         fFieldPath = checkNotNull(Arrays.copyOf(fieldPath, fieldPath.length));
         fHelpText = helpText;
@@ -65,7 +66,7 @@ public class TmfContentFieldAspect implements ITmfEventAspect {
      * @return the new aspect
      * @since 1.0
      */
-    public static TmfContentFieldAspect create(String aspectName, String helpText, String... fieldPath) {
+    public static TmfContentFieldAspect create(String aspectName, String helpText, @NonNull String... fieldPath) {
         return new TmfContentFieldAspect(aspectName, helpText, fieldPath);
     }
 
index ed57af4f13ddf230db923a100646cb714c33654e..2a8d0885032a303324ab5ecf6b7ce8bf152666e2 100644 (file)
@@ -157,7 +157,7 @@ public class TraceTypeHelper {
      *
      * @return The trace class
      */
-    public Class<? extends ITmfTrace> getTraceClass() {
+    public Class<@NonNull ? extends ITmfTrace> getTraceClass() {
         return fTrace.getClass();
     }
 
index baac253212e56b9441dcca806130448eac9ad7fd..7902bb585bdf3931d6095cc698e29bc789638048 100644 (file)
@@ -17,6 +17,7 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyStrin
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandInput;
 
@@ -32,8 +33,9 @@ public class CommandInput implements ICommandInput {
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
+
     /** The input as list of Strings. */
-    private final List<String> fInput = new ArrayList<>();
+    private final @NonNull List<@NonNull String> fInput = new ArrayList<>();
 
     // ------------------------------------------------------------------------
     // Accessors
@@ -47,6 +49,7 @@ public class CommandInput implements ICommandInput {
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
+
     @Override
     public void add(@Nullable String segment) {
         if (segment != null) {
index 29950f5e26835ec8861dcf8424d2fd21a60422e3..0a662bbd08395a0412665ad60ebd53bd6f0978b9 100644 (file)
@@ -448,8 +448,8 @@ public class TmfEventsEditor extends TmfEditor implements ITmfTraceEditor, IReus
 
     @Override
     public void resourceChanged(final IResourceChangeEvent event) {
-        final Set<IMarker> added = new HashSet<>();
-        final Set<IMarker> removed = new HashSet<>();
+        final Set<@NonNull IMarker> added = new HashSet<>();
+        final Set<@NonNull IMarker> removed = new HashSet<>();
         boolean deltaFound = false;
         for (final IMarkerDelta delta : event.findMarkerDeltas(IMarker.BOOKMARK, false)) {
             if (delta.getResource().equals(fFile)) {
index 1e7403324c5bda19874937aa768fdde98a8f12b6..f6982820ba4faae96a6d82f651215b5b2079f9e6 100644 (file)
@@ -32,6 +32,7 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.ui.editors.ITmfEventsEditorConstants;
@@ -106,7 +107,7 @@ public abstract class TmfCommonProjectElement extends TmfProjectModelElement {
 
         TraceTypeHelper helper = TmfTraceType.getTraceType(getTraceType());
 
-        Class<? extends ITmfTrace> traceClass = null;
+        Class<@NonNull ? extends ITmfTrace> traceClass = null;
 
         if (helper != null) {
             traceClass = helper.getTraceClass();
index 7eef81ef998dd76174f15d62cbe064f2997f72a2..204a184c847ab333406567287a68359a6e54f83c 100644 (file)
@@ -150,7 +150,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
     private final Map<ITmfTrace, List<TimeGraphEntry>> fEntryListMap = new HashMap<>();
 
     /** The trace to filters hash map */
-    private final Map<ITmfTrace, ViewerFilter[]> fFiltersMap = new HashMap<>();
+    private final Map<ITmfTrace, @NonNull ViewerFilter[]> fFiltersMap = new HashMap<>();
 
     /** The trace to marker event sources hash map */
     private final Map<ITmfTrace, List<IMarkerEventSource>> fMarkerEventSourcesMap = new HashMap<>();
@@ -243,9 +243,9 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
 
         Object getInput();
 
-        void setFilters(ViewerFilter[] filters);
+        void setFilters(@NonNull ViewerFilter[] filters);
 
-        ViewerFilter[] getFilters();
+        @NonNull ViewerFilter[] getFilters();
 
         void redraw();
 
@@ -336,12 +336,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
         }
 
         @Override
-        public void setFilters(ViewerFilter[] filters) {
+        public void setFilters(@NonNull ViewerFilter[] filters) {
             viewer.setFilters(filters);
         }
 
         @Override
-        public ViewerFilter[] getFilters() {
+        public @NonNull ViewerFilter[] getFilters() {
             return viewer.getFilters();
         }
 
@@ -454,12 +454,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
         }
 
         @Override
-        public void setFilters(ViewerFilter[] filters) {
+        public void setFilters(@NonNull ViewerFilter[] filters) {
             combo.setFilters(filters);
         }
 
         @Override
-        public ViewerFilter[] getFilters() {
+        public @NonNull ViewerFilter[] getFilters() {
             return combo.getFilters();
         }
 
index 3af99530f334861de5ddd3d92ee48ccebbcabb63..7d855d3251e791ce212c18cd1ac96c625347e1eb 100644 (file)
@@ -105,7 +105,7 @@ public class TimeGraphCombo extends Composite {
     private final Map<ITimeGraphSelectionListener, SelectionListenerWrapper> fSelectionListenerMap = new HashMap<>();
 
     /** The map of viewer filters to viewer filter wrappers */
-    private final Map<ViewerFilter, ViewerFilter> fViewerFilterMap = new HashMap<>();
+    private final Map<@NonNull ViewerFilter, @NonNull ViewerFilter> fViewerFilterMap = new HashMap<>();
 
     /**
      * Flag to block the tree selection changed listener when triggered by the
@@ -863,7 +863,7 @@ public class TimeGraphCombo extends Composite {
     /**
      * @param filter The filter object to be attached to the view
      */
-    public void addFilter(ViewerFilter filter) {
+    public void addFilter(@NonNull ViewerFilter filter) {
         fInhibitTreeSelection = true;
         ViewerFilter wrapper = new ViewerFilterWrapper(filter);
         fTreeViewer.addFilter(wrapper);
@@ -876,7 +876,7 @@ public class TimeGraphCombo extends Composite {
     /**
      * @param filter The filter object to be removed from the view
      */
-    public void removeFilter(ViewerFilter filter) {
+    public void removeFilter(@NonNull ViewerFilter filter) {
         fInhibitTreeSelection = true;
         ViewerFilter wrapper = fViewerFilterMap.get(filter);
         fTreeViewer.removeFilter(wrapper);
@@ -892,7 +892,7 @@ public class TimeGraphCombo extends Composite {
      * @return an array of viewer filters
      * @since 2.0
      */
-    public ViewerFilter[] getFilters() {
+    public @NonNull ViewerFilter[] getFilters() {
         return fTimeGraphViewer.getFilters();
     }
 
@@ -904,7 +904,7 @@ public class TimeGraphCombo extends Composite {
      *            an array of viewer filters, or null
      * @since 2.0
      */
-    public void setFilters(ViewerFilter[] filters) {
+    public void setFilters(@NonNull ViewerFilter[] filters) {
         fInhibitTreeSelection = true;
         fViewerFilterMap.clear();
         if (filters == null) {
index 7a84a05c6c4f047615d424ff5ed8425ad6b45151..5bdb90dd1ca504fcd3f8a9b5175e1a720a4be61d 100644 (file)
@@ -23,6 +23,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.ActionContributionItem;
 import org.eclipse.jface.action.IAction;
@@ -2443,7 +2444,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @param filter
      *            The filter object to be attached to the view
      */
-    public void addFilter(ViewerFilter filter) {
+    public void addFilter(@NonNull ViewerFilter filter) {
         fTimeGraphCtrl.addFilter(filter);
         refresh();
     }
@@ -2452,7 +2453,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @param filter
      *            The filter object to be attached to the view
      */
-    public void removeFilter(ViewerFilter filter) {
+    public void removeFilter(@NonNull ViewerFilter filter) {
         fTimeGraphCtrl.removeFilter(filter);
         refresh();
     }
@@ -2463,7 +2464,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return an array of viewer filters
      * @since 2.0
      */
-    public ViewerFilter[] getFilters() {
+    public @NonNull ViewerFilter[] getFilters() {
         return fTimeGraphCtrl.getFilters();
     }
 
@@ -2475,7 +2476,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            an array of viewer filters, or null
      * @since 2.0
      */
-    public void setFilters(ViewerFilter[] filters) {
+    public void setFilters(@NonNull ViewerFilter[] filters) {
         fTimeGraphCtrl.setFilters(filters);
         refresh();
     }
index 72c21df20e8f8df32d8b07525aaec620e2742af8..140e7e4d48efa89aa853122c6f7fdba2e41af6fb 100644 (file)
@@ -16,6 +16,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
@@ -140,7 +141,7 @@ public class ShowFilterDialogAction extends Action {
      * @param filter
      *            The filter object to be added to the viewer
      */
-    protected void addFilter(ViewerFilter filter) {
+    protected void addFilter(@NonNull ViewerFilter filter) {
         fTimeGraphViewer.addFilter(filter);
     }
 
@@ -150,7 +151,7 @@ public class ShowFilterDialogAction extends Action {
      * @param filter
      *            The filter object to be removed from the viewer
      */
-    protected void removeFilter(ViewerFilter filter) {
+    protected void removeFilter(@NonNull ViewerFilter filter) {
         fTimeGraphViewer.removeFilter(filter);
     }
 
index 681f842cfe9559f99f691c04dbc64b760d656540..5a1e37d1dacfd6b2d34cf860640d9dcc63d5ae62 100644 (file)
@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.resource.LocalResourceManager;
@@ -158,7 +159,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
     private final Cursor fResizeCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM);
     private final Cursor fWaitCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_WAIT);
     private final Cursor fZoomCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_SIZEWE);
-    private final List<ViewerFilter> fFilters = new ArrayList<>();
+    private final List<@NonNull ViewerFilter> fFilters = new ArrayList<>();
     private MenuDetectEvent fPendingMenuDetectEvent = null;
     private boolean fGridLinesVisible = true;
     private Color fGridLineColor = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
@@ -2741,7 +2742,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
     /**
      * @param filter The filter object to be attached to the view
      */
-    public void addFilter(ViewerFilter filter) {
+    public void addFilter(@NonNull ViewerFilter filter) {
         if (!fFilters.contains(filter)) {
             fFilters.add(filter);
         }
@@ -2750,7 +2751,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
     /**
      * @param filter The filter object to be attached to the view
      */
-    public void removeFilter(ViewerFilter filter) {
+    public void removeFilter(@NonNull ViewerFilter filter) {
         fFilters.remove(filter);
     }
 
@@ -2760,7 +2761,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
      * @return an array of viewer filters
      * @since 2.0
      */
-    public ViewerFilter[] getFilters() {
+    public @NonNull ViewerFilter[] getFilters() {
         return Iterables.toArray(fFilters, ViewerFilter.class);
     }
 
@@ -2771,7 +2772,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
      *            an array of viewer filters, or null
      * @since 2.0
      */
-    public void setFilters(ViewerFilter[] filters) {
+    public void setFilters(@NonNull ViewerFilter[] filters) {
         fFilters.clear();
         if (filters != null) {
             fFilters.addAll(Arrays.asList(filters));
This page took 0.053042 seconds and 5 git commands to generate.