MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator(); MultipleXYSeriesLabelGenerator g2 = null; try { g2 = (MultipleXYSeriesLabelGenerator) g1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); // check independence g1.addSeriesLabel(3, "Add3"); assertFalse(g1.equals(g2)); g2.addSeriesLabel(3, "Add3"); assertTrue(g1.equals(g2));
DialTextAnnotation a1 = new DialTextAnnotation("A1"); DialTextAnnotation a2 = null; try { a2 = (DialTextAnnotation) a1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2)); // check that the listener lists are independent MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); a1.addChangeListener(l1); assertTrue(a1.hasListener(l1)); assertFalse(a2.hasListener(l1));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/labels/junit/MultipleXYSeriesLabelGeneratorTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/dial/junit/DialTextAnnotationTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 11 Number of AST nodes: 11
1
MultipleXYSeriesLabelGenerator g1
2
                = new MultipleXYSeriesLabelGenerator();
3
        MultipleXYSeriesLabelGenerator g
1
DialTextAnnotation a1 = new DialTextAnnotation("A1");
4
2 = null;
2
        DialTextAnnotation a2 = null;
5
        try {
3
        try {
6
            g2 = (MultipleXYSeriesLabelGenerator) g1.clone();
4
            a2 = (DialTextAnnotation) a1.clone();
7
        }
5
        }
8
        catch (CloneNotSupportedException e) {
6
        catch (CloneNotSupportedException e) {
9
            e.printStackTrace();
7
            e.printStackTrace();
10
        }
8
        }
11
        assertTrue(g1 != g2);
9
        assertTrue(a1 != a2);
12
        assertTrue(g1.getClass() == g2.getClass());
10
        assertTrue(a1.getClass() == a2.getClass());
13
        assertTrue(g1.equals(g2));
11
        assertTrue(a1.equals(a2));
12
        
14
        // check independence
13
        // check that the listener lists are independent
15
        g1.addSeriesLabel(3, "Add3");
14
        
16
        assertFalse(g1.equals(g2));
15
MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
17
        g2.addSeriesLabel(3, "Add3");
16
        a1.addChangeListener(l1);
18
        assertTrue(g1.equals(g2
17
        assertTrue(a1.hasListener(l1));
19
));
18
        assertFalse(a2.hasListener(l1));
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 comparisons58
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)37.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator();
    1
    MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator();
    1
    DialTextAnnotation a1 = new DialTextAnnotation("A1");
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g1a1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    new MultipleXYSeriesLabelGenerator()new DialTextAnnotation("A1")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new MultipleXYSeriesLabelGenerator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DialTextAnnotation("A1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new MultipleXYSeriesLabelGenerator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DialTextAnnotation("A1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    DialTextAnnotation a1 = new DialTextAnnotation("A1");
    2
    MultipleXYSeriesLabelGenerator g2 = null;
    2
    MultipleXYSeriesLabelGenerator g2 = null;
    2
    DialTextAnnotation a2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g2a2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    2
    DialTextAnnotation a2 = null;
    3
    try
    3
    try
    4
    g2 = (MultipleXYSeriesLabelGenerator)g1.clone();
    4
    g2 = (MultipleXYSeriesLabelGenerator)g1.clone();
    4
    a2 = (DialTextAnnotation)a1.clone();
    Differences
    Expression1Expression2Difference
    g2a2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g1a1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (MultipleXYSeriesLabelGenerator)g1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (DialTextAnnotation)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    a2 = (DialTextAnnotation)a1.clone();
    5
    assertTrue(g1 != g2);
    5
    assertTrue(g1 != g2);
    5
    assertTrue(a1 != a2);
    Differences
    Expression1Expression2Difference
    g1a1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g2a2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    5
    assertTrue(a1 != a2);
    6
    assertTrue(g1.getClass() == g2.getClass());
    6
    assertTrue(g1.getClass() == g2.getClass());
    6
    assertTrue(a1.getClass() == a2.getClass());
    Differences
    Expression1Expression2Difference
    g1a1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g2a2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    6
    assertTrue(a1.getClass() == a2.getClass());
    7
    assertTrue(g1.equals(g2));
    7
    assertTrue(g1.equals(g2));
    7
    assertTrue(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    g2a2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g1a1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g2 cannot be unified with expression a2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression g2 cannot be unified with expression a2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    Expression g1 cannot be unified with expression a1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    7
    assertTrue(a1.equals(a2));
                                                                                                                                    
    8
    MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
    8
    g1.addSeriesLabel(3, "Add3");
    8
    g1.addSeriesLabel(3, "Add3");
    9
    a1.addChangeListener(l1);
    Differences
    Expression1Expression2Difference
    addSeriesLabeladdChangeListenerMETHOD_INVOCATION_NAME_MISMATCH
    g1a1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialTextAnnotationSUBCLASS_TYPE_MISMATCH
    g1.addSeriesLabel(3,"Add3")a1.addChangeListener(l1)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression g1.addSeriesLabel(3,"Add3") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression a1.addChangeListener(l1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression g1.addSeriesLabel(3,"Add3") is a void method call, and thus it cannot be parameterized
    Expression a1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    Expression g1 cannot be unified with expression a1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void addSeriesLabel(int, java.lang.String) , public void addChangeListener(org.jfree.chart.plot.dial.DialLayerChangeListener)
    Expression g1.addSeriesLabel(3,"Add3") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression a1.addChangeListener(l1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression g1.addSeriesLabel(3,"Add3") is a void method call, and thus it cannot be parameterized
    Expression a1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    9
    a1.addChangeListener(l1);
    9
    assertFalse(g1.equals(g2));
    9
    assertFalse(g1.equals(g2));
    Preondition Violations
    Unmatched statement assertFalse(g1.equals(g2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
                                                                          
    10
    assertTrue(a1.hasListener(l1));
    Preondition Violations
    Unmatched statement assertTrue(a1.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    assertTrue(a1.hasListener(l1));
    10
    g2.addSeriesLabel(3, "Add3");
    10
    g2.addSeriesLabel(3, "Add3");
    Preondition Violations
    Unmatched statement g2.addSeriesLabel(3,"Add3"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
                                                                            
    11
    assertFalse(a2.hasListener(l1));
    Preondition Violations
    Unmatched statement assertFalse(a2.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    assertFalse(a2.hasListener(l1));
    11
    assertTrue(g1.equals(g2));
    11
    assertTrue(g1.equals(g2));
    Preondition Violations
    Unmatched statement assertTrue(g1.equals(g2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    Precondition Violations (24)
    Row Violation
    1Expression new MultipleXYSeriesLabelGenerator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DialTextAnnotation("A1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new MultipleXYSeriesLabelGenerator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new DialTextAnnotation("A1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression (MultipleXYSeriesLabelGenerator)g1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (DialTextAnnotation)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression g2 cannot be unified with expression a2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    8Expression g2 cannot be unified with expression a2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    9Expression g1 cannot be unified with expression a1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    10Expression g1.addSeriesLabel(3,"Add3") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression a1.addChangeListener(l1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression g1.addSeriesLabel(3,"Add3") is a void method call, and thus it cannot be parameterized
    13Expression a1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    14Expression g1 cannot be unified with expression a1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void addSeriesLabel(int, java.lang.String) , public void addChangeListener(org.jfree.chart.plot.dial.DialLayerChangeListener)
    15Expression g1.addSeriesLabel(3,"Add3") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression a1.addChangeListener(l1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression g1.addSeriesLabel(3,"Add3") is a void method call, and thus it cannot be parameterized
    18Expression a1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    19Unmatched statement assertFalse(g1.equals(g2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    20Unmatched statement assertTrue(a1.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    21Unmatched statement g2.addSeriesLabel(3,"Add3"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22Unmatched statement assertFalse(a2.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23Unmatched statement assertTrue(g1.equals(g2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    24Clone fragment #1 returns variables g1, g2 , while Clone fragment #2 returns variables a1, a2