From: Alexandre Montplaisir Date: Wed, 6 Feb 2013 16:43:07 +0000 (-0500) Subject: tmf: Remove Cloneable from (I)TmfCheckpoint X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=a12b0e0fc0866cc7dcb195fb34b5dd52cba491ac;p=deliverable%2Ftracecompass.git tmf: Remove Cloneable from (I)TmfCheckpoint It was not used anywhere, except in tests, and the object isn't made to be modified already. Change-Id: I36330f3bf6b3c20e37ab2be88aa90984cbd2a05f Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/10215 Tested-by: Hudson CI Reviewed-by: Patrick Tasse IP-Clean: Patrick Tasse --- diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java index dbb1669f64..95c2535e44 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java @@ -16,7 +16,6 @@ package org.eclipse.linuxtools.tmf.core.tests.trace; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -84,38 +83,6 @@ public class TmfCheckpointTest { } } - // ------------------------------------------------------------------------ - // clone - // ------------------------------------------------------------------------ - - @Test - public void testClone() { - try { - TmfCheckpoint checkpoint1 = fCheckpoint1.clone(); - TmfCheckpoint checkpoint2 = fCheckpoint1.clone(); - TmfCheckpoint checkpoint3 = fCheckpoint1.clone(); - - assertEquals("clone", checkpoint1, fCheckpoint1); - assertEquals("clone", checkpoint2, fCheckpoint1); - assertEquals("clone", checkpoint3, fCheckpoint1); - - checkpoint1 = new TmfCheckpoint(fTimestamp1, null); - checkpoint2 = checkpoint1.clone(); - assertEquals("clone", checkpoint1, checkpoint2); - assertNull(checkpoint1.getContext()); - assertNull(checkpoint2.getContext()); - - checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1)); - checkpoint3 = checkpoint1.clone(); - assertEquals("clone", checkpoint1, checkpoint3); - assertNull(checkpoint1.getTimestamp()); - assertNull(checkpoint3.getTimestamp()); - - } catch (final InternalError e) { - fail("clone()"); - } - } - // ------------------------------------------------------------------------ // compareTo // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java index c89ba5ff71..eee80c1fb5 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java @@ -45,18 +45,10 @@ public interface ITmfCheckpoint extends Comparable { */ public ITmfLocation getLocation(); - /** - * @return a clone of the checkpoint - */ - public ITmfCheckpoint clone(); - // ------------------------------------------------------------------------ // Comparable // ------------------------------------------------------------------------ - /* (non-Javadoc) - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ @Override public int compareTo(ITmfCheckpoint checkpoint); diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java index ee58f0081e..0ff7084f7f 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java @@ -25,29 +25,22 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; * @see ITmfLocation * @see ITmfTimestamp */ -public class TmfCheckpoint implements ITmfCheckpoint, Cloneable { +public class TmfCheckpoint implements ITmfCheckpoint { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ // The checkpoint context - private ITmfContext fContext; + private final ITmfContext fContext; // The checkpoint timestamp - private ITmfTimestamp fTimestamp; + private final ITmfTimestamp fTimestamp; // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ - /** - * Default constructor - */ - @SuppressWarnings("unused") - private TmfCheckpoint() { - } - /** * Full constructor * @@ -72,25 +65,6 @@ public class TmfCheckpoint implements ITmfCheckpoint, Cloneable { fContext = other.fContext; } - // ------------------------------------------------------------------------ - // Cloneable - // ------------------------------------------------------------------------ - - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - @Override - public TmfCheckpoint clone() { - TmfCheckpoint clone = null; - try { - clone = (TmfCheckpoint) super.clone(); - clone.fContext = (fContext != null) ? fContext.clone() : null; - clone.fTimestamp = fTimestamp; - } catch (final CloneNotSupportedException e) { - } - return clone; - } - // ------------------------------------------------------------------------ // ITmfCheckpoint // ------------------------------------------------------------------------