tmf: Add some nonNull annotation to the tmf.core.analysis package
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Fri, 31 Oct 2014 16:35:06 +0000 (12:35 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 11 Nov 2014 22:14:36 +0000 (17:14 -0500)
And some more of those where required.

Change-Id: I369b0c5a0a2db8b3fccc6f6b97a2ba272b14fb28
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/35752
Tested-by: Hudson CI
26 files changed:
org.eclipse.tracecompass.lttng2.kernel.core.tests/src/org/eclipse/tracecompass/lttng2/kernel/core/tests/analysis/kernel/LttngKernelAnalysisTest.java
org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/lttng2/kernel/core/analysis/cpuusage/LttngKernelCpuUsageAnalysis.java
org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/lttng2/kernel/core/analysis/kernel/LttngKernelAnalysis.java
org.eclipse.tracecompass.lttng2.ust.core.tests/src/org/eclipse/tracecompass/lttng2/ust/core/tests/trace/callstack/AbstractProviderTest.java
org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/analysis/memory/UstMemoryAnalysisModule.java
org.eclipse.tracecompass.tmf.analysis.xml.core.tests/src/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java
org.eclipse.tracecompass.tmf.analysis.xml.core.tests/src/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java
org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/TmfAnalysisModuleHelperXml.java
org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/analysis/AnalysisManagerTest.java
org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/analysis/AnalysisModuleHelperTest.java
org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/analysis/AnalysisParameterProviderTest.java
org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/analysis/AnalysisModuleTestHelper.java
org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/analysis/TestAnalysis.java
org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/analysis/TestRequirementAnalysis.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/IAnalysisModule.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/IAnalysisModuleHelper.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAbstractAnalysisModule.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAbstractAnalysisParamProvider.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisManager.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleOutputs.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfNewAnalysisOutputListener.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTrace.java
org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfLostEventStatisticsTest.java
org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/statistics/TmfStateStatisticsTest.java
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfAnalysisElement.java

index c996397f4038a13588d966505d8ac0a1af32dd73..c9c649583154db1be1248b464fd2947bc4c4285a 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestHelper;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
 import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
@@ -91,8 +92,10 @@ public class LttngKernelAnalysisTest {
     @Test
     public void testAnalysisExecution() {
         fKernelAnalysisModule.setId("test");
+        ITmfTrace trace = fTrace;
+        assertNotNull(trace);
         try {
-            fKernelAnalysisModule.setTrace(fTrace);
+            fKernelAnalysisModule.setTrace(trace);
         } catch (TmfAnalysisException e) {
             fail(e.getMessage());
         }
index fa377f5e4a42f2c93578600d2cc8db18497ef26a..f4fdc9c4c18d6a387cfda2627e25bc4aaa700769 100644 (file)
@@ -75,11 +75,15 @@ public class LttngKernelCpuUsageAnalysis extends TmfStateSystemAnalysisModule {
 
     @Override
     protected boolean executeAnalysis(IProgressMonitor monitor) {
+        ITmfTrace trace = getTrace();
+        if (trace == null) {
+            throw new IllegalStateException();
+        }
         /*
          * This analysis depends on the LTTng kernel analysis, so we'll start
          * that build at the same time
          */
-        LttngKernelAnalysis module = getTrace().getAnalysisModuleOfClass(LttngKernelAnalysis.class, LttngKernelAnalysis.ID);
+        LttngKernelAnalysis module = trace.getAnalysisModuleOfClass(LttngKernelAnalysis.class, LttngKernelAnalysis.ID);
         if (module != null) {
             module.schedule();
         }
index c89be00b2a8d9fdcc1f7e916d16bf344214a2e5b..5ef742900d997c9bead93b3bad393d9ead15b809 100644 (file)
@@ -70,7 +70,7 @@ public class LttngKernelAnalysis extends TmfStateSystemAnalysisModule {
             );
 
     /** The requirements as an immutable set */
-    private static final ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
+    private static final @NonNull ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
 
     static {
         /* initialize the requirement: domain and events */
@@ -80,7 +80,10 @@ public class LttngKernelAnalysis extends TmfStateSystemAnalysisModule {
         TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
         eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
 
-        REQUIREMENTS = ImmutableSet.of(domainReq, eventReq);
+
+        @SuppressWarnings("null")
+        @NonNull ImmutableSet<TmfAnalysisRequirement> reqSet = ImmutableSet.of(domainReq, eventReq);
+        REQUIREMENTS = reqSet;
     }
 
     @Override
@@ -106,7 +109,9 @@ public class LttngKernelAnalysis extends TmfStateSystemAnalysisModule {
 
     @Override
     protected String getFullHelpText() {
-        return Messages.LttngKernelAnalysisModule_Help;
+        @SuppressWarnings("null")
+        @NonNull String helpText = Messages.LttngKernelAnalysisModule_Help;
+        return helpText;
     }
 
     @Override
index e6b09e24262f79ebbdfb6a884ba87f68b0877acd..5383b2a52f14708978074fd43484ea36582dcfd2 100644 (file)
@@ -97,10 +97,11 @@ public abstract class AbstractProviderTest {
     public void setUp() {
         CtfTmfTestTrace testTrace = getTestTrace();
 
-        fTrace = testTrace.getTrace();
+        CtfTmfTrace trace = testTrace.getTrace();
+        fTrace = trace;
         fModule = new TestLttngCallStackModule();
         try {
-            fModule.setTrace(fTrace);
+            fModule.setTrace(trace);
         } catch (TmfAnalysisException e) {
             fail();
         }
index 3c45cf3c07323821a1895cb344da1b196958864c..bf47ebcd3365cb738538d0dc2c1844c93f2348dc 100644 (file)
@@ -13,6 +13,7 @@
 
 package org.eclipse.tracecompass.lttng2.ust.core.analysis.memory;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.memoryusage.MemoryUsageStateProvider;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.memoryusage.UstMemoryStrings;
 import org.eclipse.tracecompass.lttng2.control.core.session.SessionConfigStrings;
@@ -50,7 +51,7 @@ public class UstMemoryAnalysisModule extends TmfStateSystemAnalysisModule {
             );
 
     /** The requirements as an immutable set */
-    private static final ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
+    private static final @NonNull ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
 
     static {
         /* Initialize the requirements for the analysis: domain and events */
@@ -66,7 +67,9 @@ public class UstMemoryAnalysisModule extends TmfStateSystemAnalysisModule {
         TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN);
         domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, ValuePriorityLevel.MANDATORY);
 
-        REQUIREMENTS = ImmutableSet.of(domainReq, eventsReq);
+        @SuppressWarnings("null")
+        @NonNull ImmutableSet<TmfAnalysisRequirement> reqSet = ImmutableSet.of(domainReq, eventsReq);
+        REQUIREMENTS = reqSet;
     }
 
     @Override
index 5503c27a875f167b8afd06068f488516cf9f2e86..7edee8809e452d46890f2b22a7555656c67db004 100644 (file)
@@ -89,6 +89,7 @@ public class StateProviderModuleTest {
         Element node = (Element) stateproviderNodes.item(0);
         fModule = new XmlStateSystemModule();
         String moduleId = node.getAttribute(TmfXmlStrings.ID);
+        assertNotNull(moduleId);
         fModule.setId(moduleId);
         assertEquals(ANALYSIS_ID, fModule.getId());
 
@@ -113,6 +114,7 @@ public class StateProviderModuleTest {
         Element node = (Element) stateproviderNodes.item(0);
         fModule = new XmlStateSystemModule();
         String moduleId = node.getAttribute(TmfXmlStrings.ID);
+        assertNotNull(moduleId);
         fModule.setId(moduleId);
 
         fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath()));
index 6533ee547a4d8ed8f7061fae321e0d88076ac260..068ae027708bf1dfcfdf5e306817bf53ea894f32 100644 (file)
@@ -62,7 +62,8 @@ public class StateProviderTest {
     public void setupTest() {
         /* Initialize the trace */
         assumeTrue(CtfTmfTestTrace.KERNEL.exists());
-        fTrace = CtfTmfTestTrace.KERNEL.getTrace();
+        ITmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
+        fTrace = trace;
 
         /* Initialize the state provider module */
         Document doc = null;
@@ -86,12 +87,13 @@ public class StateProviderTest {
         Element node = (Element) stateproviderNodes.item(0);
         fModule = new XmlStateSystemModule();
         String moduleId = node.getAttribute(TmfXmlStrings.ID);
+        assertNotNull(moduleId);
         fModule.setId(moduleId);
 
         fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath()));
 
         try {
-            fModule.setTrace(fTrace);
+            fModule.setTrace(trace);
             fModule.schedule();
         } catch (TmfAnalysisException e) {
             fail("Cannot set trace " + e.getMessage());
@@ -103,7 +105,7 @@ public class StateProviderTest {
      */
     @After
     public void cleanupTest() {
-        CtfTmfTestTrace.KERNEL.dispose();
+        fTrace.dispose();
     }
 
     /**
index 527c944613ff646a35f69cd80b15b3fc30baa6a7..a182131210cae8cd24da0a8c9768b4e873a70b1a 100644 (file)
@@ -70,7 +70,13 @@ public class TmfAnalysisModuleHelperXml implements IAnalysisModuleHelper {
 
     @Override
     public String getId() {
-        return fSourceElement.getAttribute(TmfXmlStrings.ID);
+        /*
+         * The attribute ID cannot be null because the XML has been validated
+         * and it is mandatory
+         */
+        @SuppressWarnings("null")
+        @NonNull String id = fSourceElement.getAttribute(TmfXmlStrings.ID);
+        return id;
     }
 
     @Override
index cf7fec7a0df2426fc90cf4452e9dab5d1ee93f8e..16efc1db904e1f1a2bd33b48dbd43658466394df 100644 (file)
 package org.eclipse.tracecompass.tmf.core.tests.analysis;
 
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Map;
 
+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.TmfAnalysisManager;
@@ -34,13 +36,13 @@ import org.junit.Test;
 public class AnalysisManagerTest {
 
     /** Id of analysis module with parameter */
-    public static final String MODULE_PARAM = "org.eclipse.linuxtools.tmf.core.tests.analysis.test";
+    public static final @NonNull String MODULE_PARAM = "org.eclipse.linuxtools.tmf.core.tests.analysis.test";
     /** ID of analysis module with parameter and default value */
-    public static final String MODULE_PARAM_DEFAULT = "org.eclipse.linuxtools.tmf.core.tests.analysis.test2";
+    public static final @NonNull String MODULE_PARAM_DEFAULT = "org.eclipse.linuxtools.tmf.core.tests.analysis.test2";
     /** ID of analysis module for trace 2 classes only */
-    public static final String MODULE_SECOND = "org.eclipse.linuxtools.tmf.core.tests.analysis.testother";
+    public static final @NonNull String MODULE_SECOND = "org.eclipse.linuxtools.tmf.core.tests.analysis.testother";
     /** Id of analysis module with requirements */
-    public static final String MODULE_REQ = "org.eclipse.linuxtools.tmf.core.tests.analysis.reqtest";
+    public static final @NonNull String MODULE_REQ = "org.eclipse.linuxtools.tmf.core.tests.analysis.reqtest";
 
     private ITmfTrace fTrace;
 
@@ -85,14 +87,18 @@ public class AnalysisManagerTest {
     public void testListForTraces() {
         /* Generic TmfTrace */
         ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace();
-        Map<String, IAnalysisModuleHelper> map = TmfAnalysisManager.getAnalysisModules(trace.getClass());
+        Class<? extends ITmfTrace> traceClass = trace.getClass();
+        assertNotNull(traceClass);
+        Map<String, IAnalysisModuleHelper> map = TmfAnalysisManager.getAnalysisModules(traceClass);
 
         assertTrue(map.containsKey(MODULE_PARAM));
         assertTrue(map.containsKey(MODULE_PARAM_DEFAULT));
         assertFalse(map.containsKey(MODULE_SECOND));
 
         /* TmfTraceStub2 class */
-        map = TmfAnalysisManager.getAnalysisModules(fTrace.getClass());
+        traceClass = fTrace.getClass();
+        assertNotNull(traceClass);
+        map = TmfAnalysisManager.getAnalysisModules(traceClass);
 
         assertTrue(map.containsKey(MODULE_PARAM));
         assertTrue(map.containsKey(MODULE_PARAM_DEFAULT));
@@ -107,12 +113,16 @@ 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();
-        Map<String, IAnalysisModuleHelper> map = TmfAnalysisManager.getAnalysisModules(trace.getClass());
+        Class<? extends ITmfTrace> traceClass = trace.getClass();
+        assertNotNull(traceClass);
+        Map<String, IAnalysisModuleHelper> map = TmfAnalysisManager.getAnalysisModules(traceClass);
 
         assertFalse(map.containsKey(AnalysisModuleTestHelper.moduleStubEnum.TEST.name()));
 
         /* TmfTraceStub2 class */
-        map = TmfAnalysisManager.getAnalysisModules(fTrace.getClass());
+        Class<? extends ITmfTrace> ftraceClass = fTrace.getClass();
+        assertNotNull(ftraceClass);
+        map = TmfAnalysisManager.getAnalysisModules(ftraceClass);
 
         assertFalse(map.containsKey(AnalysisModuleTestHelper.moduleStubEnum.TEST2.name()));
 
@@ -120,10 +130,10 @@ public class AnalysisManagerTest {
         TmfAnalysisManager.registerModuleSource(new AnalysisModuleSourceStub());
 
         /* Now make sure the modules are present */
-        map = TmfAnalysisManager.getAnalysisModules(trace.getClass());
+        map = TmfAnalysisManager.getAnalysisModules(traceClass);
         assertTrue(map.containsKey(AnalysisModuleTestHelper.moduleStubEnum.TEST.name()));
 
-        map = TmfAnalysisManager.getAnalysisModules(fTrace.getClass());
+        map = TmfAnalysisManager.getAnalysisModules(ftraceClass);
         assertTrue(map.containsKey(AnalysisModuleTestHelper.moduleStubEnum.TEST2.name()));
     }
 
index 4f6a2e0ab8fa7b566d33c5934ceb59e59b697732..32d7f41e583fe631c35d93da6121942d76ca808c 100644 (file)
@@ -166,8 +166,10 @@ public class AnalysisModuleHelperTest {
 
         /* TestAnalysis2 module with a TraceStub2 */
         exception = null;
+        ITmfTrace trace = fTrace;
+        assertNotNull(trace);
         try {
-            module = fModuleOther.newModule(fTrace);
+            module = fModuleOther.newModule(trace);
             assertNotNull(module);
             assertTrue(module instanceof TestAnalysis2);
         } catch (TmfAnalysisException e) {
@@ -192,6 +194,7 @@ public class AnalysisModuleHelperTest {
          * able to set the parameter
          */
         IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(AnalysisManagerTest.MODULE_PARAM);
+        assertNotNull(helper);
         IAnalysisModule module = null;
         try {
             module = helper.newModule(trace);
@@ -210,6 +213,7 @@ public class AnalysisModuleHelperTest {
 
         /* This module has a parameter with default value */
         helper = TmfAnalysisManager.getAnalysisModule(AnalysisManagerTest.MODULE_PARAM_DEFAULT);
+        assertNotNull(helper);
         try {
             module = helper.newModule(trace);
             assertEquals(3, module.getParameter(TestAnalysis.PARAM_TEST));
@@ -230,9 +234,12 @@ public class AnalysisModuleHelperTest {
          * error
          */
         helper = TmfAnalysisManager.getAnalysisModule(AnalysisManagerTest.MODULE_SECOND);
+        assertNotNull(helper);
         Exception exception = null;
+        trace = fTrace;
+        assertNotNull(trace);
         try {
-            module = helper.newModule(fTrace);
+            module = helper.newModule(trace);
             assertNull(module.getParameter(TestAnalysis.PARAM_TEST));
 
             try {
index 857581547df41fbfe3944f60cc296d3ffdfadd85..9de062712a840ebaee0ce823d54c10535848036d 100644 (file)
@@ -13,6 +13,7 @@
 package org.eclipse.tracecompass.tmf.core.tests.analysis;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 import java.util.List;
@@ -61,6 +62,7 @@ public class AnalysisParameterProviderTest {
         ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace();
         /* Make sure the value is set to null */
         IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(AnalysisManagerTest.MODULE_PARAM);
+        assertNotNull(helper);
         IAnalysisModule module = null;
         try {
             module = helper.newModule(trace);
index 68d09884ccab6d7abb2567b08bcee2e77cc7bb85..1f4b962e73603c2dd226b1c3cf1103a84781f368 100644 (file)
@@ -59,12 +59,14 @@ public class AnalysisModuleTestHelper implements IAnalysisModuleHelper {
 
     @Override
     public String getId() {
-        return fModule.name();
+        return getName();
     }
 
     @Override
     public String getName() {
-        return fModule.name();
+        @SuppressWarnings("null")
+        @NonNull String name = fModule.name();
+        return name;
     }
 
     @Override
index 00fa5b5afea56f90c45a71371ade5996b45f39f0..b453646c30a533df18bb349e8a04146c59a82b5b 100644 (file)
@@ -13,6 +13,7 @@
 package org.eclipse.tracecompass.tmf.tests.stubs.analysis;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 
@@ -21,12 +22,12 @@ import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
  */
 public class TestAnalysis extends TmfAbstractAnalysisModule {
 
-    private int output = 0;
-
     /**
      * Test parameter. If set, simulate cancellation
      */
-    public static final String PARAM_TEST = "test";
+    public static final @NonNull String PARAM_TEST = "test";
+
+    private int fOutput = 0;
 
     /**
      * Constructor
@@ -47,7 +48,7 @@ public class TestAnalysis extends TmfAbstractAnalysisModule {
         }
         /* If PARAM_TEST is set to 0, simulate cancellation */
         if ((Integer) getParameter(PARAM_TEST) == 0) {
-            output = 0;
+            fOutput = 0;
             return false;
         } else if ((Integer) getParameter(PARAM_TEST) == 999) {
             /* just stay in an infinite loop until cancellation */
@@ -56,13 +57,17 @@ public class TestAnalysis extends TmfAbstractAnalysisModule {
             }
             return !monitor.isCanceled();
         }
-        output = (Integer) getParameter(PARAM_TEST);
+        Object obj = getParameter(PARAM_TEST);
+        if (obj == null) {
+            throw new IllegalStateException();
+        }
+        fOutput = (Integer) obj;
         return true;
     }
 
     @Override
     protected void canceling() {
-        output = -1;
+        fOutput = -1;
     }
 
     @Override
@@ -85,7 +90,7 @@ public class TestAnalysis extends TmfAbstractAnalysisModule {
      * @return The analysis output
      */
     public int getAnalysisOutput() {
-        return output;
+        return fOutput;
     }
 
 }
index d0343bce4ec5aa5dcc9f9b0875ba7e9f8c3bc0fe..aaabc62250e6d885742d4fc35c8d0bc1b32519d4 100644 (file)
 
 package org.eclipse.tracecompass.tmf.tests.stubs.analysis;
 
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement.ValuePriorityLevel;
@@ -76,6 +78,8 @@ public class TestRequirementAnalysis extends TmfAbstractAnalysisModule {
         requirements.get(FIELD_TYPE).addValue(PID, ValuePriorityLevel.MANDATORY);
         requirements.get(FIELD_TYPE).addValue(TID, ValuePriorityLevel.MANDATORY);
 
-        return requirements.values();
+        @SuppressWarnings("null")
+        @NonNull Collection<TmfAnalysisRequirement> values = requirements.values();
+        return values;
     }
 }
index f7073d75cff0c6d496803695b3e61e65fed1796c..cb244b43737cecada22f93fa1001a9fe8516eb95 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.tracecompass.tmf.core.analysis;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.component.ITmfComponent;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -54,7 +55,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @param name
      *            name of the module
      */
-    void setName(String name);
+    void setName(@NonNull String name);
 
     /**
      * Sets the id of the module
@@ -62,15 +63,14 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @param id
      *            id of the module
      */
-    void setId(String id);
+    void setId(@NonNull String id);
 
     /**
      * Gets the id of the analysis module
      *
      * @return The id of the module
      */
-    @NonNull
-    String getId();
+    @NonNull String getId();
 
     /**
      * Sets whether this analysis should be run automatically at trace opening
@@ -99,7 +99,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      *            The trace to run the analysis on
      * @throws TmfAnalysisException
      */
-    void setTrace(ITmfTrace trace) throws TmfAnalysisException;
+    void setTrace(@NonNull ITmfTrace trace) throws TmfAnalysisException;
 
     /**
      * Add a parameter to this module
@@ -107,7 +107,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @param name
      *            Name of the parameter
      */
-    void addParameter(String name);
+    void addParameter(@NonNull String name);
 
     /**
      * Sets the value of a parameter
@@ -118,7 +118,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      *            The value (subclasses may type-check it)
      * @throws RuntimeException
      */
-    void setParameter(String name, Object value);
+    void setParameter(@NonNull String name, @Nullable Object value);
 
     /**
      * Gets the value of a parameter
@@ -127,7 +127,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      *            Name of the parameter
      * @return The value of a parameter
      */
-    Object getParameter(String name);
+    @Nullable Object getParameter(@NonNull String name);
 
     // -----------------------------------------------------
     // Functionalities
@@ -152,14 +152,14 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @return An IStatus indicating if the execution of the analysis could be
      *         scheduled successfully or not.
      */
-    IStatus schedule();
+    @NonNull IStatus schedule();
 
     /**
      * Gets a list of outputs
      *
      * @return The list of {@link IAnalysisOutput}
      */
-    Iterable<IAnalysisOutput> getOutputs();
+    @NonNull Iterable<IAnalysisOutput> getOutputs();
 
     /**
      * Registers an output for this analysis
@@ -167,7 +167,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @param output
      *            The {@link IAnalysisOutput} object
      */
-    void registerOutput(IAnalysisOutput output);
+    void registerOutput(@NonNull IAnalysisOutput output);
 
     /**
      * Block the calling thread until this analysis has completed (or has been
@@ -194,7 +194,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      *         scheduled to run at all. In all cases, the quality or
      *         availability of the output(s) and results is not guaranteed.
      */
-    boolean waitForCompletion(IProgressMonitor monitor);
+    boolean waitForCompletion(@NonNull IProgressMonitor monitor);
 
     /**
      * Cancels the current analysis
@@ -218,7 +218,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      *
      * @return The generic help text
      */
-    String getHelpText();
+    @NonNull String getHelpText();
 
     /**
      * Gets a help text specific for a given trace
@@ -230,7 +230,7 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      *            The trace to analyze
      * @return A help text with information on a specific trace
      */
-    String getHelpText(ITmfTrace trace);
+    @NonNull String getHelpText(@NonNull ITmfTrace trace);
 
     /**
      * Notify the module that the value of a parameter has changed
@@ -238,5 +238,5 @@ public interface IAnalysisModule extends ITmfComponent, IAnalysisRequirementProv
      * @param name
      *            The of the parameter that changed
      */
-    void notifyParameterChanged(String name);
+    void notifyParameterChanged(@NonNull String name);
 }
index 8122c9ff187eac6c6f73dd2aa0f4b278d935f264..52ba888b430fe512aec2fbdeee8c000fcfebc536 100644 (file)
@@ -35,14 +35,14 @@ public interface IAnalysisModuleHelper extends IAnalysisRequirementProvider {
      *
      * @return The id of the module
      */
-    String getId();
+    @NonNull String getId();
 
     /**
      * Gets the name of the analysis module
      *
      * @return The id of the module
      */
-    String getName();
+    @NonNull String getName();
 
     /**
      * Gets whether the analysis should be run automatically at trace opening
@@ -133,6 +133,6 @@ public interface IAnalysisModuleHelper extends IAnalysisRequirementProvider {
      * @throws TmfAnalysisException
      *             Exceptions that occurred when setting trace
      */
-    IAnalysisModule newModule(ITmfTrace trace) throws TmfAnalysisException;
+    IAnalysisModule newModule(@NonNull ITmfTrace trace) throws TmfAnalysisException;
 
 }
index 0b4f8593fd5b5c293ac0ced80fa488ff6a467835..9a1d2ab7b76251c5cf8033a2c895c4c493e3fe69 100644 (file)
@@ -23,9 +23,12 @@ import java.util.concurrent.TimeUnit;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement.ValuePriorityLevel;
@@ -45,16 +48,17 @@ import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
  * @author Geneviève Bastien
  * @since 3.0
  */
+@NonNullByDefault
 public abstract class TmfAbstractAnalysisModule extends TmfComponent implements IAnalysisModule {
 
-    private String fName, fId;
+    private @Nullable String fId;
     private boolean fAutomatic = false, fStarted = false;
-    private volatile ITmfTrace fTrace;
+    private volatile @Nullable ITmfTrace fTrace;
     private final Map<String, Object> fParameters = new HashMap<>();
     private final List<String> fParameterNames = new ArrayList<>();
     private final List<IAnalysisOutput> fOutputs = new ArrayList<>();
     private List<IAnalysisParameterProvider> fParameterProviders = new ArrayList<>();
-    private Job fJob = null;
+    private @Nullable Job fJob = null;
 
     private final Object syncObj = new Object();
 
@@ -70,16 +74,12 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
 
     @Override
     public String getName() {
-        String name = fName;
-        if (name == null) {
-            return ""; //$NON-NLS-1$
-        }
-        return name;
+        return super.getName();
     }
 
     @Override
     public void setName(String name) {
-        fName = name;
+        super.setName(name);
     }
 
     @Override
@@ -88,7 +88,6 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
     }
 
     @Override
-    @NonNull
     public String getId() {
         String id = fId;
         if (id == null) {
@@ -105,9 +104,6 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
 
     @Override
     public void setTrace(ITmfTrace trace) throws TmfAnalysisException {
-        if (trace == null) {
-            throw new TmfAnalysisException(Messages.TmfAbstractAnalysisModule_NullTrace);
-        }
         if (fTrace != null) {
             throw new TmfAnalysisException(NLS.bind(Messages.TmfAbstractAnalysisModule_TraceSetMoreThanOnce, getName()));
         }
@@ -132,7 +128,7 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
      *
      * @return The trace
      */
-    protected ITmfTrace getTrace() {
+    protected @Nullable ITmfTrace getTrace() {
         return fTrace;
     }
 
@@ -142,7 +138,7 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
     }
 
     @Override
-    public synchronized void setParameter(String name, Object value) {
+    public synchronized void setParameter(String name, @Nullable Object value) {
         if (!fParameterNames.contains(name)) {
             throw new RuntimeException(NLS.bind(Messages.TmfAbstractAnalysisModule_InvalidParameter, name, getName()));
         }
@@ -176,7 +172,7 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
     }
 
     @Override
-    public Object getParameter(String name) {
+    public @Nullable Object getParameter(String name) {
         Object paramValue = fParameters.get(name);
         /* The parameter is not set, maybe it can be provided by someone else */
         if ((paramValue == null) && (fTrace != null)) {
@@ -191,7 +187,7 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
     }
 
     @Override
-    public boolean canExecute(@NonNull ITmfTrace trace) {
+    public boolean canExecute(ITmfTrace trace) {
         for (TmfAnalysisRequirement requirement : getAnalysisRequirements()) {
             if (!requirement.isFulfilled(trace)) {
                 return false;
@@ -260,7 +256,7 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
         cancel();
     }
 
-    private void execute(@NonNull final ITmfTrace trace) {
+    private void execute(final ITmfTrace trace) {
 
         /*
          * TODO: The analysis in a job should be done at the analysis manager
@@ -284,18 +280,24 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
         /*
          * Actual analysis will be run on a separate thread
          */
-        fJob = new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())) {
+        @SuppressWarnings("null")
+        @NonNull String jobName = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName());
+        fJob = new Job(jobName) {
             @Override
-            protected IStatus run(final IProgressMonitor monitor) {
+            protected @Nullable IStatus run(final @Nullable IProgressMonitor monitor) {
+                IProgressMonitor mon = monitor;
+                if (mon == null) {
+                    mon = new NullProgressMonitor();
+                }
                 try {
-                    monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
+                    mon.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
                     broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this));
-                    fAnalysisCancelled = !executeAnalysis(monitor);
+                    fAnalysisCancelled = !executeAnalysis(mon);
                 } catch (TmfAnalysisException e) {
                     Activator.logError("Error executing analysis with trace " + trace.getName(), e); //$NON-NLS-1$
                 } finally {
                     synchronized (syncObj) {
-                        monitor.done();
+                        mon.done();
                         setAnalysisCompleted();
                     }
                     TmfTraceManager.refreshSupplementaryFiles(trace);
@@ -327,7 +329,9 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
             execute(trace);
         }
 
-        return Status.OK_STATUS;
+        @SuppressWarnings("null")
+        @NonNull IStatus status = Status.OK_STATUS;
+        return status;
     }
 
     @Override
@@ -410,7 +414,9 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
      * @return Full help text for the module
      */
     protected String getFullHelpText() {
-        return NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisModule, getName());
+        @SuppressWarnings("null")
+        @NonNull String text = NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisModule, getName());
+        return text;
     }
 
     /**
@@ -422,7 +428,9 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
      * @return Short help text describing the module
      */
     protected String getShortHelpText(ITmfTrace trace) {
-        return NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisForTrace, getName(), trace.getName());
+        @SuppressWarnings("null")
+        @NonNull String text = NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisForTrace, getName(), trace.getName());
+        return text;
     }
 
     /**
@@ -434,7 +442,7 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
      *            The trace to apply the analysis to
      * @return Help text
      */
-    protected String getTraceCannotExecuteHelpText(@NonNull ITmfTrace trace) {
+    protected String getTraceCannotExecuteHelpText(ITmfTrace trace) {
         StringBuilder builder = new StringBuilder();
         builder.append(NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisCannotExecute, getName()));
         for (TmfAnalysisRequirement requirement : getAnalysisRequirements()) {
@@ -450,7 +458,9 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
                 }
             }
         }
-        return builder.toString();
+        @SuppressWarnings("null")
+        @NonNull String helpText = builder.toString();
+        return helpText;
     }
 
     @Override
@@ -460,9 +470,6 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
 
     @Override
     public String getHelpText(ITmfTrace trace) {
-        if (trace == null) {
-            return getHelpText();
-        }
         String text = getShortHelpText(trace);
         if (!canExecute(trace)) {
             text = text + "\n\n" + getTraceCannotExecuteHelpText(trace); //$NON-NLS-1$
@@ -472,6 +479,8 @@ public abstract class TmfAbstractAnalysisModule extends TmfComponent implements
 
     @Override
     public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
-        return Collections.EMPTY_SET;
+        @SuppressWarnings("null")
+        @NonNull Iterable<TmfAnalysisRequirement> emptySet = Collections.EMPTY_SET;
+        return emptySet;
     }
 }
index 368df8398979e5a8a4c62ae705bf78f1de3b6ac1..6dc42fd2cabf29fd0e6b12f3078f047bf14a2ff5 100644 (file)
@@ -64,8 +64,9 @@ public abstract class TmfAbstractAnalysisParamProvider implements IAnalysisParam
      *            Name of the modified parameter
      */
     protected void notifyParameterChanged(String name) {
-        if (fModule != null) {
-            fModule.notifyParameterChanged(name);
+        IAnalysisModule module = fModule;
+        if (module != null && name != null) {
+            module.notifyParameterChanged(name);
         }
     }
 }
index 9fce5d5c1b653a4444d6f65d730bdfcaeac6b40b..96fe0e1820aa93a2b72a8ca1abe25032f27ab770 100644 (file)
@@ -18,6 +18,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.internal.tmf.core.analysis.TmfAnalysisModuleSources;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -29,6 +32,7 @@ import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
  * @author Geneviève Bastien
  * @since 3.0
  */
+@NonNullByDefault
 public class TmfAnalysisManager {
 
     private static final Map<String, IAnalysisModuleHelper> fAnalysisModules = new HashMap<>();
@@ -112,7 +116,9 @@ public class TmfAnalysisManager {
                 }
             }
         }
-        return Collections.unmodifiableMap(fAnalysisModules);
+        @SuppressWarnings("null")
+        @NonNull Map<String, IAnalysisModuleHelper> map = Collections.unmodifiableMap(fAnalysisModules);
+        return map;
     }
 
     /**
@@ -132,7 +138,9 @@ public class TmfAnalysisManager {
                 map.put(module.getId(), module);
             }
         }
-        return Collections.unmodifiableMap(map);
+        @SuppressWarnings("null")
+        @NonNull Map<String, IAnalysisModuleHelper> retMap = Collections.unmodifiableMap(map);
+        return retMap;
     }
 
     /**
@@ -142,7 +150,7 @@ public class TmfAnalysisManager {
      *            Id of the analysis module to get
      * @return The {@link IAnalysisModuleHelper}
      */
-    public static IAnalysisModuleHelper getAnalysisModule(String id) {
+    public static @Nullable IAnalysisModuleHelper getAnalysisModule(String id) {
         Map<String, IAnalysisModuleHelper> map = getAnalysisModules();
         return map.get(id);
     }
index 880a4ab4a68d860c570b6917641eeca9977830b0..92b47db370cd94730b08fbd03b990e9c13e7c701 100644 (file)
@@ -58,12 +58,20 @@ public class TmfAnalysisModuleHelperConfigElement implements IAnalysisModuleHelp
 
     @Override
     public String getId() {
-        return fCe.getAttribute(TmfAnalysisModuleSourceConfigElement.ID_ATTR);
+        String id = fCe.getAttribute(TmfAnalysisModuleSourceConfigElement.ID_ATTR);
+        if (id == null) {
+            throw new IllegalStateException();
+        }
+        return id;
     }
 
     @Override
     public String getName() {
-        return fCe.getAttribute(TmfAnalysisModuleSourceConfigElement.NAME_ATTR);
+        String name = fCe.getAttribute(TmfAnalysisModuleSourceConfigElement.NAME_ATTR);
+        if (name == null) {
+            throw new IllegalStateException();
+        }
+        return name;
     }
 
     @Override
@@ -179,10 +187,14 @@ public class TmfAnalysisModuleHelperConfigElement implements IAnalysisModuleHelp
         /* Get the module's parameters */
         final IConfigurationElement[] parametersCE = fCe.getChildren(TmfAnalysisModuleSourceConfigElement.PARAMETER_ELEM);
         for (IConfigurationElement element : parametersCE) {
-            module.addParameter(element.getAttribute(TmfAnalysisModuleSourceConfigElement.NAME_ATTR));
+            String paramName = element.getAttribute(TmfAnalysisModuleSourceConfigElement.NAME_ATTR);
+            if (paramName == null) {
+                continue;
+            }
+            module.addParameter(paramName);
             String defaultValue = element.getAttribute(TmfAnalysisModuleSourceConfigElement.DEFAULT_VALUE_ATTR);
             if (defaultValue != null) {
-                module.setParameter(element.getAttribute(TmfAnalysisModuleSourceConfigElement.NAME_ATTR), defaultValue);
+                module.setParameter(paramName, defaultValue);
             }
         }
         module.setTrace(trace);
index 7436e7e07973d17c6454520ef390fd94bc105a7d..bdc63a79f3cc574cf76cd902655852236a9452ca 100644 (file)
@@ -74,6 +74,10 @@ public class TmfAnalysisModuleOutputs {
             if (elementName.equals(OUTPUT_ELEM)) {
                 try {
                     IAnalysisOutput output = (IAnalysisOutput) ce.createExecutableExtension(CLASS_ATTR);
+                    if (output == null) {
+                        Activator.logWarning("An output could not be created"); //$NON-NLS-1$
+                        continue;
+                    }
                     ITmfNewAnalysisModuleListener listener = null;
                     for (IConfigurationElement childCe : ce.getChildren()) {
                         if (childCe.getName().equals(ANALYSIS_ID_ELEM)) {
index b32fc7ad29be1b7ff67695bfbea1d392b36452cc..d76315965d7ab1fa1eae517409cc657c4432315b 100644 (file)
@@ -12,6 +12,8 @@
 
 package org.eclipse.tracecompass.tmf.core.analysis;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 /**
  * This class listens when new analysis modules are created and registers an
  * output if the module corresponds to the output specifications
@@ -23,7 +25,7 @@ public class TmfNewAnalysisOutputListener implements ITmfNewAnalysisModuleListen
 
     private final String fAnalysisId;
     private final Class<? extends IAnalysisModule> fAnalysisModuleClass;
-    private final IAnalysisOutput fOutput;
+    private final @NonNull IAnalysisOutput fOutput;
 
     /**
      * Constructor
@@ -36,7 +38,7 @@ public class TmfNewAnalysisOutputListener implements ITmfNewAnalysisModuleListen
      * @param moduleClass
      *            The module class this output applies to
      */
-    public TmfNewAnalysisOutputListener(IAnalysisOutput output, String analysisId, Class<? extends IAnalysisModule> moduleClass) {
+    public TmfNewAnalysisOutputListener(@NonNull IAnalysisOutput output, String analysisId, Class<? extends IAnalysisModule> moduleClass) {
         fOutput = output;
         fAnalysisId = analysisId;
         fAnalysisModuleClass = moduleClass;
index 4ba16bf7379d75e5bcc94738937aff56b64414b8..2d6421897a2868b9453c2b9eb3a77ea512d293c1 100644 (file)
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.MultiStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleHelper;
@@ -282,7 +283,10 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, IT
      */
     protected IStatus executeAnalysis() {
         MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
-        Map<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules(this.getClass());
+
+        @SuppressWarnings("null")
+        @NonNull Class<? extends TmfTrace> className = this.getClass();
+        Map<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules(className);
         for (IAnalysisModuleHelper helper : modules.values()) {
             try {
                 IAnalysisModule module = helper.newModule(this);
index b335e69b6f14727794da3d98bb1901e416e0a567..ad31fa9b3c44a0cf75a7e882a4e57db26f7d25ab 100644 (file)
@@ -77,14 +77,15 @@ public class CtfTmfLostEventStatisticsTest {
      */
     @Before
     public void setUp() {
-        fTrace = lostEventsTrace.getTrace();
+        ITmfTrace trace = lostEventsTrace.getTrace();
+        fTrace = trace;
 
         /* Prepare the two analysis-backed state systems */
         fTotalsMod = new TmfStatisticsTotalsModule();
         fEventTypesMod = new TmfStatisticsEventTypesModule();
         try {
-            fTotalsMod.setTrace(fTrace);
-            fEventTypesMod.setTrace(fTrace);
+            fTotalsMod.setTrace(trace);
+            fEventTypesMod.setTrace(trace);
         } catch (TmfAnalysisException e) {
             fail();
         }
index b3e161caa74a781f9f940fa1fc766d9eb8d7c4e8..49625b53b85a927066ad80106ab697fe4d32ac95 100644 (file)
@@ -52,14 +52,15 @@ public class TmfStateStatisticsTest extends TmfStatisticsTest {
      */
     @Before
     public void setUp() {
-        fTrace = testTrace.getTrace();
+        ITmfTrace trace = testTrace.getTrace();
+        fTrace = trace;
 
         /* Prepare the two analysis-backed state systems */
         fTotalsMod = new TmfStatisticsTotalsModule();
         fEventTypesMod = new TmfStatisticsEventTypesModule();
         try {
-            fTotalsMod.setTrace(fTrace);
-            fEventTypesMod.setTrace(fTrace);
+            fTotalsMod.setTrace(trace);
+            fEventTypesMod.setTrace(trace);
         } catch (TmfAnalysisException e) {
             fail();
         }
index 16c2dccc776fb7b694559d18c8d100f3783f7c9a..914f4ab03223a84b6cdbcb6af06d4ff84279430f 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jface.viewers.StyledString.Styler;
 import org.eclipse.swt.graphics.TextStyle;
 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
@@ -46,7 +47,7 @@ public class TmfAnalysisElement extends TmfProjectModelElement implements ITmfSt
         }
     };
 
-    private final String fAnalysisId;
+    private final @NonNull String fAnalysisId;
     private boolean fCanExecute = true;
 
     /**
@@ -61,7 +62,7 @@ public class TmfAnalysisElement extends TmfProjectModelElement implements ITmfSt
      * @param id
      *            The analysis module id
      */
-    protected TmfAnalysisElement(String name, IResource resource, ITmfProjectModelElement parent, String id) {
+    protected TmfAnalysisElement(String name, IResource resource, ITmfProjectModelElement parent, @NonNull String id) {
         super(name, resource, parent);
         fAnalysisId = id;
         parent.addChild(this);
This page took 0.045666 seconds and 5 git commands to generate.