ss: Make modifyAttribute()'s value parameter @NonNull
authorSonia Farrah <sonia.farrah@ericsson.com>
Wed, 11 May 2016 17:42:13 +0000 (13:42 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 6 Jul 2016 11:06:51 +0000 (07:06 -0400)
Change-Id: I2adbf60b127f8cb7acd040b7214b3ae4dc921406
Signed-off-by: Sonia Farrah <sonia.farrah@ericsson.com>
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/72550
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
btf/org.eclipse.tracecompass.btf.core/src/org/eclipse/tracecompass/btf/core/analysis/BtfStateProvider.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/statesystem/core/ITmfStateSystemBuilder.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/core/model/TmfXmlScenarioHistoryBuilder.java

index 6cece218604dc64c68c2d7157324db990c2c3e84..b606152bb1b738ac325c1d1ab733a55af55f8410 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.tracecompass.btf.core.analysis;
 
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.btf.core.event.BtfEvent;
 import org.eclipse.tracecompass.btf.core.trace.BtfColumnNames;
 import org.eclipse.tracecompass.btf.core.trace.BtfTrace;
@@ -65,14 +66,14 @@ public class BtfStateProvider extends AbstractTmfStateProvider {
 
     private static class TmfNamedStateValue {
         private final String fName;
-        private final TmfStateValue fValue;
+        private final @NonNull TmfStateValue fValue;
 
-        public TmfNamedStateValue(TmfStateValue value, String name) {
+        public TmfNamedStateValue(@NonNull TmfStateValue value, String name) {
             fValue = value;
             fName = name;
         }
 
-        public TmfStateValue getValue() {
+        public @NonNull TmfStateValue getValue() {
             return fValue;
         }
 
index 2a3378c825e7d564391bd186acb2d47ff6509a40..3f8a6425bc0335b77c6ba62597ebcb59200596f4 100644 (file)
@@ -360,15 +360,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
     //--------------------------------------------------------------------------
 
     @Override
-    public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
+    public void modifyAttribute(long t, @NonNull ITmfStateValue value, int attributeQuark)
             throws TimeRangeException, StateValueTypeException {
-        if (value == null) {
-            /*
-             * TODO Replace with @NonNull parameter (will require fixing all the
-             * state providers!)
-             */
-            throw new IllegalArgumentException();
-        }
         transState.processStateChange(t, value, attributeQuark);
     }
 
@@ -387,7 +380,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
     }
 
     @Override
-    public void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
+    public void pushAttribute(long t, @NonNull ITmfStateValue value, int attributeQuark)
             throws TimeRangeException, StateValueTypeException {
         int stackDepth;
         int subAttributeQuark;
index 881ddf0300e62201c0f5c0e775dfa8d9ca9850da..70ee1308599b14b4b2a190097f42f470f1a5ff4b 100644 (file)
@@ -127,7 +127,7 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *             If the inserted state value's type does not match what is
      *             already assigned to this attribute.
      */
-    void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
+    void modifyAttribute(long t, @NonNull ITmfStateValue value, int attributeQuark)
             throws StateValueTypeException;
 
     /**
@@ -176,7 +176,7 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *             If the attribute 'attributeQuark' already exists, but is not
      *             of integer type.
      */
-    void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
+    void pushAttribute(long t, @NonNull ITmfStateValue value, int attributeQuark)
             throws StateValueTypeException;
 
     /**
index e4e678dd87c2c5704ee35c98cfdbe22b4a97069f..1ac28e329810e9e3799afa727ced3e40ddc1f9bb 100644 (file)
@@ -337,7 +337,7 @@ public class TmfXmlScenarioHistoryBuilder {
                 value = TmfStateValue.nullValue();
                 break;
             }
-            ss.modifyAttribute(ts, value, info.getStatusQuark());
+            ss.modifyAttribute(ts, NonNullUtils.checkNotNull(value), info.getStatusQuark());
         } catch (StateValueTypeException e) {
             Activator.logError("failed to update scenario status"); //$NON-NLS-1$
         }
This page took 0.027064 seconds and 5 git commands to generate.