XYImageAnnotation a1 = new XYImageAnnotation(10.0, 20.0, JFreeChart.INFO.getLogo()); XYImageAnnotation a2 = null; try { a2 = (XYImageAnnotation) a1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2));
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/annotations/junit/XYImageAnnotationTests.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
XYImageAnnotation a1 = new XYImageAnnotation(10.0, 20.0,
2
                JFreeChart.INFO.getLogo());
3
        XYImageAnnotation a
1
LineRenderer3D r1 = new LineRenderer3D();
4
2 = null;
2
        LineRenderer3D r2 = null;
5
        try {
3
        try {
6
            a2 = (XYImageAnnotation) a1.clone();
4
            r2 = (LineRenderer3D) r1.clone();
7
        }
5
        }
8
        catch (CloneNotSupportedException e) {
6
        catch (CloneNotSupportedException e) {
9
            e.printStackTrace();
7
            e.printStackTrace();
10
        }
8
        }
11
        assertTrue(a1 != a2);
9
        assertTrue(r1 != r2);
12
        assertTrue(a1.getClass() == a2.getClass());
10
        assertTrue(r1.getClass() == r2.getClass());
13
        assertTrue(a1.equals(a
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 comparisons27
  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 fragment1
    Time elapsed for statement mapping (ms)130.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    XYImageAnnotation a1 = new XYImageAnnotation(10.0, 20.0, JFreeChart.INFO.getLogo());
    1
    XYImageAnnotation a1 = new XYImageAnnotation(10.0, 20.0, JFreeChart.INFO.getLogo());
    1
    LineRenderer3D r1 = new LineRenderer3D();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    a1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    new XYImageAnnotation(10.0,20.0,JFreeChart.INFO.getLogo())new LineRenderer3D()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new XYImageAnnotation(10.0,20.0,JFreeChart.INFO.getLogo()) 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
    Expression new XYImageAnnotation(10.0,20.0,JFreeChart.INFO.getLogo()) 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
    XYImageAnnotation a2 = null;
    2
    XYImageAnnotation a2 = null;
    2
    LineRenderer3D r2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    a2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    2
    LineRenderer3D r2 = null;
    3
    try
    3
    try
    4
    a2 = (XYImageAnnotation)a1.clone();
    4
    a2 = (XYImageAnnotation)a1.clone();
    4
    r2 = (LineRenderer3D)r1.clone();
    Differences
    Expression1Expression2Difference
    a2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    a1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (XYImageAnnotation)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (LineRenderer3D)r1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    r2 = (LineRenderer3D)r1.clone();
    5
    assertTrue(a1 != a2);
    5
    assertTrue(a1 != a2);
    5
    assertTrue(r1 != r2);
    Differences
    Expression1Expression2Difference
    a1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    a2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    5
    assertTrue(r1 != r2);
    6
    assertTrue(a1.getClass() == a2.getClass());
    6
    assertTrue(a1.getClass() == a2.getClass());
    6
    assertTrue(r1.getClass() == r2.getClass());
    Differences
    Expression1Expression2Difference
    a1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    a2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    6
    assertTrue(r1.getClass() == r2.getClass());
    7
    assertTrue(a1.equals(a2));
    7
    assertTrue(a1.equals(a2));
    7
    assertTrue(r1.equals(r2));
    Differences
    Expression1Expression2Difference
    a2r2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    a1r1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.LineRenderer3DSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression a2 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 a2 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 a1 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 (11)
    Row Violation
    1Expression new XYImageAnnotation(10.0,20.0,JFreeChart.INFO.getLogo()) 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
    3Expression new XYImageAnnotation(10.0,20.0,JFreeChart.INFO.getLogo()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new LineRenderer3D() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression (XYImageAnnotation)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (LineRenderer3D)r1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression a2 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)
    8Expression a2 cannot be unified with expression r2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    9Expression a1 cannot be unified with expression r1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    10Unmatched 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
    11Clone fragment #1 returns variables , while Clone fragment #2 returns variables r1, r2