tmf.core: Partial ss API should not expose restricted classes
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Fri, 3 Feb 2017 18:39:41 +0000 (13:39 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Mon, 6 Feb 2017 20:08:34 +0000 (15:08 -0500)
Since the callers of the partial state system do not have access to the
StateSystem class, it should not be required. It is replace by an
internal validation of the input.

Change-Id: Id2c345fa36ce048990419feba4898b64e7a14823
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/90308
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Alexandre Montplaisir <alexmonthy@efficios.com>
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/statesystem/TmfStateSystemAnalysisModule.java

index a94670ce30f67953a4778b2b269b21199f7617ee..a66dd65f2515eab7d0cc4d8e06e7efc930619f51 100644 (file)
@@ -20,6 +20,7 @@ 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;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
 import org.eclipse.tracecompass.statesystem.core.backend.StateHistoryBackendFactory;
 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -64,8 +65,11 @@ public class PartialStateSystem extends StateSystem {
      * @param ss
      *            The real state system
      */
-    public void assignUpstream(StateSystem ss) {
-        realStateSystem = ss;
+    public void assignUpstream(ITmfStateSystemBuilder ss) {
+        if (!(ss instanceof StateSystem)) {
+            throw new IllegalArgumentException("Partial state system's upstream state system should be of class StateSystem. This one is " + ss.getClass()); //$NON-NLS-1$
+        }
+        realStateSystem = (StateSystem) ss;
         ssAssignedLatch.countDown();
     }
 
index 4a688bd97770f4cf4dd0a9777a1451327a045acf..6002e2ac103cc891f1266dd941341b59446c4522 100644 (file)
@@ -396,9 +396,7 @@ public abstract class TmfStateSystemAnalysisModule extends TmfAbstractAnalysisMo
         IStateHistoryBackend partialBackend = new PartialHistoryBackend(id + ".partial", partialProvider, pss, realBackend, granularity); //$NON-NLS-1$
 
         /* 4 */
-        @SuppressWarnings("restriction")
-        org.eclipse.tracecompass.internal.statesystem.core.StateSystem realSS =
-        (org.eclipse.tracecompass.internal.statesystem.core.StateSystem) StateSystemFactory.newStateSystem(partialBackend);
+        ITmfStateSystemBuilder realSS = StateSystemFactory.newStateSystem(partialBackend);
 
         /* 5 */
         pss.assignUpstream(realSS);
This page took 0.02724 seconds and 5 git commands to generate.