CategoryTick t1 = new CategoryTick( "C1", new TextBlock(), TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f ); CategoryTick t2 = null; try { t2 = (CategoryTick) t1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(t1 != t2); assertTrue(t1.getClass() == t2.getClass()); assertTrue(t1.equals(t2));
DateTick t1 = new DateTick( new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0 ); DateTick t2 = null; try { t2 = (DateTick) t1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(t1 != t2); assertTrue(t1.getClass() == t2.getClass()); assertTrue(t1.equals(t2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/CategoryTickTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateTickTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 7 Number of AST nodes: 7
1
CategoryTick t1 = new CategoryTick(
1
DateTick t1 = new DateTick(
2
            "C1", new TextBlock(), TextBlockAnchor.CENTER, 
2
            new Date(0L), "Label", TextAnchor.CENTER, 
3
            TextAnchor.CENTER, 1.5f
3
TextAnchor.CENTER, 10.0
4
        );
4
        );
5
        CategoryTick t2 = null;
5
        DateTick t2 = null;
6
        try {
6
        try {
7
            t2 = (CategoryTick) t1.clone();
7
            t2 = (DateTick) t1.clone();
8
        }
8
        }
9
        catch (CloneNotSupportedException e) {
9
        catch (CloneNotSupportedException e) {
10
            System.err.println("Failed to clone.");
10
            System.err.println("Failed to clone.");
11
        }
11
        }
12
        assertTrue(t1 != t2);
12
        assertTrue(t1 != t2);
13
        assertTrue(t1.getClass() == t2.getClass());
13
        assertTrue(t1.getClass() == t2.getClass());
14
        assertTrue(t1.equals(t2));
14
        assertTrue(t1.equals(t2));
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.2
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)17.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CategoryTick t1 = new CategoryTick("C1", new TextBlock(), TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f);
    1
    CategoryTick t1 = new CategoryTick("C1", new TextBlock(), TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f);
    2
    DateTick t2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    t1t2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    new CategoryTick("C1",new TextBlock(),TextBlockAnchor.CENTER,TextAnchor.CENTER,1.5f)nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new CategoryTick("C1",new TextBlock(),TextBlockAnchor.CENTER,TextAnchor.CENTER,1.5f) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    DateTick t2 = null;
    2
    CategoryTick t2 = null;
    2
    CategoryTick t2 = null;
    1
    DateTick t1 = new DateTick(new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    t2t1VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    nullnew DateTick(new Date(0L),"Label",TextAnchor.CENTER,TextAnchor.CENTER,10.0)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new DateTick(new Date(0L),"Label",TextAnchor.CENTER,TextAnchor.CENTER,10.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    DateTick t1 = new DateTick(new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0);
    3
    try
    3
    try
    4
    t2 = (CategoryTick)t1.clone();
    4
    t2 = (CategoryTick)t1.clone();
    4
    t2 = (DateTick)t1.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.axis.DateTickSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (CategoryTick)t1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (DateTick)t1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    t2 = (DateTick)t1.clone();
                                                    
    5
    assertTrue(t1 != t2);
    Preondition Violations
    Unmatched statement assertTrue(t1 != t2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    assertTrue(t1 != t2);
    5
    assertTrue(t1 != t2);
    5
    assertTrue(t1 != t2);
    Preondition Violations
    Unmatched statement assertTrue(t1 != t2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
                                                                                                
    6
    assertTrue(t1.getClass() == t2.getClass());
    Preondition Violations
    Unmatched statement assertTrue(t1.getClass() == t2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    assertTrue(t1.getClass() == t2.getClass());
    6
    assertTrue(t1.getClass() == t2.getClass());
    6
    assertTrue(t1.getClass() == t2.getClass());
    Preondition Violations
    Unmatched statement assertTrue(t1.getClass() == t2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                                                              
    7
    assertTrue(t1.equals(t2));
    Preondition Violations
    Unmatched statement assertTrue(t1.equals(t2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    assertTrue(t1.equals(t2));
    7
    assertTrue(t1.equals(t2));
    7
    assertTrue(t1.equals(t2));
    Preondition Violations
    Unmatched statement assertTrue(t1.equals(t2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    Precondition Violations (11)
    Row Violation
    1Expression new CategoryTick("C1",new TextBlock(),TextBlockAnchor.CENTER,TextAnchor.CENTER,1.5f) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DateTick(new Date(0L),"Label",TextAnchor.CENTER,TextAnchor.CENTER,10.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression (CategoryTick)t1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression (DateTick)t1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement assertTrue(t1 != t2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement assertTrue(t1 != t2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement assertTrue(t1.getClass() == t2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement assertTrue(t1.getClass() == t2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement assertTrue(t1.equals(t2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement assertTrue(t1.equals(t2)); 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 t1, t2 , while Clone fragment #2 returns variables t1, t2