DateAxis a1 = new DateAxis("Test"); DateAxis a2 = null; try { a2 = (DateAxis) a1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2));
CompassPlot p1 = new CompassPlot(new DefaultValueDataset(15.0)); CompassPlot p2 = null; try { p2 = (CompassPlot) p1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateAxisTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CompassPlotTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 7 Number of AST nodes: 7
1
DateAxis a1 = new DateAxis("Test");
2
        DateAxis a
1
CompassPlot p1 = new CompassPlot(new DefaultValueDataset(15.0));
3
2 = null;
2
        CompassPlot p2 = null;
4
        try {
3
        try {
5
            a2 = (DateAxis) a1.clone();
4
            p2 = (CompassPlot) p1.clone();
6
        }
5
        }
7
        catch (CloneNotSupportedException e) {
6
        catch (CloneNotSupportedException e) {
8
            e.printStackTrace();
7
            e.printStackTrace();
9
        }
8
        }
10
        assertTrue(a1 != a2);
9
        assertTrue(p1 != p2);
11
        assertTrue(a1.getClass() == a2.getClass());
10
        assertTrue(p1.getClass() == p2.getClass());
12
        assertTrue(a1.equals(a2));
11
        assertTrue(p1.equals(p2));
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 comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)97.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    DateAxis a1 = new DateAxis("Test");
    1
    DateAxis a1 = new DateAxis("Test");
    2
    CompassPlot p2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    a1p2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    new DateAxis("Test")nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new DateAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    CompassPlot p2 = null;
    2
    DateAxis a2 = null;
    2
    DateAxis a2 = null;
    1
    CompassPlot p1 = new CompassPlot(new DefaultValueDataset(15.0));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    a2p1VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    nullnew CompassPlot(new DefaultValueDataset(15.0))TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new CompassPlot(new DefaultValueDataset(15.0)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    CompassPlot p1 = new CompassPlot(new DefaultValueDataset(15.0));
    3
    try
    3
    try
    4
    a2 = (DateAxis)a1.clone();
    4
    a2 = (DateAxis)a1.clone();
    4
    p2 = (CompassPlot)p1.clone();
    Differences
    Expression1Expression2Difference
    a2p2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    a1p1VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.plot.CompassPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression a2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (DateAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (CompassPlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    p2 = (CompassPlot)p1.clone();
                                                    
    5
    assertTrue(p1 != p2);
    Preondition Violations
    Unmatched statement assertTrue(p1 != p2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    assertTrue(p1 != p2);
    5
    assertTrue(a1 != a2);
    5
    assertTrue(a1 != a2);
    Preondition Violations
    Unmatched statement assertTrue(a1 != a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
                                                                                                
    6
    assertTrue(p1.getClass() == p2.getClass());
    Preondition Violations
    Unmatched statement assertTrue(p1.getClass() == p2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    assertTrue(p1.getClass() == p2.getClass());
    6
    assertTrue(a1.getClass() == a2.getClass());
    6
    assertTrue(a1.getClass() == a2.getClass());
    Preondition Violations
    Unmatched statement assertTrue(a1.getClass() == a2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                                                              
    7
    assertTrue(p1.equals(p2));
    Preondition Violations
    Unmatched statement assertTrue(p1.equals(p2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    assertTrue(p1.equals(p2));
    7
    assertTrue(a1.equals(a2));
    7
    assertTrue(a1.equals(a2));
    Preondition Violations
    Unmatched statement assertTrue(a1.equals(a2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    Precondition Violations (15)
    Row Violation
    1Expression new DateAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new CompassPlot(new DefaultValueDataset(15.0)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression a2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression p2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression (DateAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (CompassPlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression p1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Unmatched statement assertTrue(p1 != p2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement assertTrue(a1 != a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement assertTrue(p1.getClass() == p2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched statement assertTrue(a1.getClass() == a2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement assertTrue(p1.equals(p2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14Unmatched statement assertTrue(a1.equals(a2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15Clone fragment #1 returns variables a1, a2 , while Clone fragment #2 returns variables p1, p2