FastScatterPlot p1 = new FastScatterPlot(); FastScatterPlot p2 = null; try { p2 = (FastScatterPlot) p1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); System.err.println("Failed to clone."); } assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2));
LineRenderer3D r1 = new LineRenderer3D(); LineRenderer3D r2 = null; try { r2 = (LineRenderer3D) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); assertTrue(checkIndependence(r1, r2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/FastScatterPlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/LineRenderer3DTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 7 Number of AST nodes: 8
1
FastScatterPlot p1 = new FastScatterPlot();
2
        FastScatterPlot p
1
LineRenderer3D r1 = new LineRenderer3D();
3
2 = null;
2
        LineRenderer3D r2 = null;
4
        try {
3
        try {
5
            p2 = (FastScatterPlot) p1.clone();
4
            r2 = (LineRenderer3D) r1.clone();
6
        }
5
        }
7
        catch (CloneNotSupportedException e) {
6
        catch (CloneNotSupportedException e) {
8
            e.printStackTrace();
7
            e.printStackTrace();
9
            System.err.println("Failed to clone.");
10
        }
8
        }
11
        assertTrue(p1 != p2);
9
        assertTrue(r1 != r2);
12
        assertTrue(p1.getClass() == p2.getClass());
10
        assertTrue(r1.getClass() == r2.getClass());
13
        assertTrue(p1.equals(p
11
        assertTrue(r1.equals(r2));
14
2));
12
        assertTrue(checkIndependence(r1, r2));
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 comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)220.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    FastScatterPlot p1 = new FastScatterPlot();
    1
    FastScatterPlot p1 = new FastScatterPlot();
    1
    LineRenderer3D r1 = new LineRenderer3D();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    p1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new FastScatterPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new LineRenderer3D() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    LineRenderer3D r1 = new LineRenderer3D();
    2
    FastScatterPlot p2 = null;
    2
    FastScatterPlot p2 = null;
    2
    LineRenderer3D r2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    p2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    2
    LineRenderer3D r2 = null;
                
    3
    try
                                                                      
    4
    r2 = (LineRenderer3D)r1.clone();
    Preondition Violations
    Unmatched statement r2=(LineRenderer3D)r1.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    r2 = (LineRenderer3D)r1.clone();
    3
    try
                
    4
    p2 = (FastScatterPlot)p1.clone();
    4
    p2 = (FastScatterPlot)p1.clone();
    Preondition Violations
    Unmatched statement p2=(FastScatterPlot)p1.clone(); 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(p1 != p2);
    5
    assertTrue(r1 != r2);
    Differences
    Expression1Expression2Difference
    p1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    p2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    5
    assertTrue(r1 != r2);
    6
    assertTrue(p1.getClass() == p2.getClass());
    6
    assertTrue(p1.getClass() == p2.getClass());
    6
    assertTrue(r1.getClass() == r2.getClass());
    Differences
    Expression1Expression2Difference
    p1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    p2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    6
    assertTrue(r1.getClass() == r2.getClass());
    7
    assertTrue(p1.equals(p2));
    7
    assertTrue(p1.equals(p2));
    7
    assertTrue(r1.equals(r2));
    Differences
    Expression1Expression2Difference
    p2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    p1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.FastScatterPlotorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression p2 cannot be unified with expression r2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression p2 cannot be unified with expression r2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    Expression p1 cannot be unified with expression r1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    7
    assertTrue(r1.equals(r2));
                                                                                    
    8
    assertTrue(checkIndependence(r1, r2));
    Preondition Violations
    Unmatched statement assertTrue(checkIndependence(r1,r2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    assertTrue(checkIndependence(r1, r2));
    Precondition Violations (9)
    Row Violation
    1Expression new FastScatterPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new LineRenderer3D() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement r2=(LineRenderer3D)r1.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement p2=(FastScatterPlot)p1.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Expression p2 cannot be unified with expression r2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    6Expression p2 cannot be unified with expression r2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    7Expression p1 cannot be unified with expression r1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    8Unmatched statement assertTrue(checkIndependence(r1,r2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Clone fragment #1 returns variables p1, p2 , while Clone fragment #2 returns variables r1, r2