IntervalMarker m1 = new IntervalMarker(45.0, 50.0); IntervalMarker m2 = null; try { m2 = (IntervalMarker) m1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(m1 != m2); assertTrue(m1.getClass() == m2.getClass()); assertTrue(m1.equals(m2));
ValueMarker m1 = new ValueMarker(25.0); ValueMarker m2 = null; try { m2 = (ValueMarker) m1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(m1 != m2); assertTrue(m1.getClass() == m2.getClass()); assertTrue(m1.equals(m2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/IntervalMarkerTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/ValueMarkerTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 7 Number of AST nodes: 7
1
IntervalMarker m1 = new IntervalMarker(45.0, 50.0);
1
ValueMarker m1 = new ValueMarker(25.0);
2
        IntervalMarker m2 = null;
2
        ValueMarker m2 = null;
3
        try {
3
        try {
4
            m2 = (IntervalMarker) m1.clone();
4
            m2 = (ValueMarker) m1.clone();
5
        }
5
        }
6
        catch (CloneNotSupportedException e) {
6
        catch (CloneNotSupportedException e) {
7
            e.printStackTrace();
7
            e.printStackTrace();
8
        }
8
        }
9
        assertTrue(m1 != m2);
9
        assertTrue(m1 != m2);
10
        assertTrue(m1.getClass() == m2.getClass());
10
        assertTrue(m1.getClass() == m2.getClass());
11
        assertTrue(m1.equals(m2));
11
        assertTrue(m1.equals(m2));
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes having the same super class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    IntervalMarker m1 = new IntervalMarker(45.0, 50.0);
    1
    IntervalMarker m1 = new IntervalMarker(45.0, 50.0);
    1
    ValueMarker m1 = new ValueMarker(25.0);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    new IntervalMarker(45.0,50.0)new ValueMarker(25.0)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new IntervalMarker(45.0,50.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new ValueMarker(25.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new IntervalMarker(45.0,50.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new ValueMarker(25.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    ValueMarker m1 = new ValueMarker(25.0);
    2
    IntervalMarker m2 = null;
    2
    IntervalMarker m2 = null;
    2
    ValueMarker m2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    2
    ValueMarker m2 = null;
    3
    try
    3
    try
    4
    m2 = (IntervalMarker)m1.clone();
    4
    m2 = (IntervalMarker)m1.clone();
    4
    m2 = (ValueMarker)m1.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (IntervalMarker)m1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ValueMarker)m1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    m2 = (ValueMarker)m1.clone();
    5
    assertTrue(m1 != m2);
    5
    assertTrue(m1 != m2);
    5
    assertTrue(m1 != m2);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    5
    assertTrue(m1 != m2);
    6
    assertTrue(m1.getClass() == m2.getClass());
    6
    assertTrue(m1.getClass() == m2.getClass());
    6
    assertTrue(m1.getClass() == m2.getClass());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    6
    assertTrue(m1.getClass() == m2.getClass());
    7
    assertTrue(m1.equals(m2));
    7
    assertTrue(m1.equals(m2));
    7
    assertTrue(m1.equals(m2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.IntervalMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    7
    assertTrue(m1.equals(m2));
    Precondition Violations (6)
    Row Violation
    1Expression new IntervalMarker(45.0,50.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new ValueMarker(25.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new IntervalMarker(45.0,50.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new ValueMarker(25.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression (IntervalMarker)m1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (ValueMarker)m1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted