tmf: Remove Cloneable from (I)TmfCheckpoint
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 6 Feb 2013 16:43:07 +0000 (11:43 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 6 Feb 2013 20:44:03 +0000 (15:44 -0500)
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 <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/10215
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>

org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfCheckpointTest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfCheckpoint.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpoint.java

index dbb1669f64d4c5e5367f1b59b7f739b70a4b9371..95c2535e44e7258b3f62d1f5ba4f8a43ac96ca45 100644 (file)
@@ -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
     // ------------------------------------------------------------------------
index c89ba5ff71e86b017f18d48e427c03a2963ccf37..eee80c1fb59fa5c099f119b3ecabe57895db572e 100644 (file)
@@ -45,18 +45,10 @@ public interface ITmfCheckpoint extends Comparable<ITmfCheckpoint> {
      */
     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);
 
index ee58f0081ec74685e8cd33bf5e72cec41b614b95..0ff7084f7f46cd49a8bf0f2e7cd9dfd149635737 100644 (file)
@@ -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
     // ------------------------------------------------------------------------
This page took 0.029837 seconds and 5 git commands to generate.