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));
DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = null; try { i2 = (DialPointer) i1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(i1 != i2); assertTrue(i1.getClass() == i2.getClass()); assertTrue(i1.equals(i2)); // check that the listener lists are independent MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); i1.addChangeListener(l1); assertTrue(i1.hasListener(l1)); assertFalse(i2.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/DialPointerTests.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
DialPointer i1 = new DialPointer.Pin(1);
4
2 = null;
2
        DialPointer i2 = null;
5
        try {
3
        try {
6
            g2 = (MultipleXYSeriesLabelGenerator) g1.clone();
4
            i2 = (DialPointer) i1.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(i1 != i2);
12
        assertTrue(g1.getClass() == g2.getClass());
10
        assertTrue(i1.getClass() == i2.getClass());
13
        assertTrue(g1.equals(g2));
11
        assertTrue(i1.equals(i2));
12
        
14
        // check independence
13
        // check that the listener lists are independent
15
        g1.addSeriesLabel(3, "Add3");
14
        
16
        assertFalse(g1.equals(g2));
17
        g2.addSeriesLabel(3, "Add3");
18
        assertTrue(g1.equals(g2
15
MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
16
        i1.addChangeListener(l1);
17
        assertTrue(i1.hasListener(l1));
19
));
18
        assertFalse(i2.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 comparisons65
  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)78.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator();
    1
    MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator();
    1
    DialPointer i1 = new DialPointer.Pin(1);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g1i1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointer.PinSUBCLASS_TYPE_MISMATCH
    MultipleXYSeriesLabelGeneratorDialPointer.PinTYPE_COMPATIBLE_REPLACEMENT
    new MultipleXYSeriesLabelGenerator()new DialPointer.Pin(1)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new MultipleXYSeriesLabelGenerator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DialPointer.Pin(1) 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 DialPointer.Pin(1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    DialPointer i1 = new DialPointer.Pin(1);
    2
    MultipleXYSeriesLabelGenerator g2 = null;
    2
    MultipleXYSeriesLabelGenerator g2 = null;
    2
    DialPointer i2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g2i2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    2
    DialPointer i2 = null;
    3
    try
    3
    try
    4
    g2 = (MultipleXYSeriesLabelGenerator)g1.clone();
    4
    g2 = (MultipleXYSeriesLabelGenerator)g1.clone();
    4
    i2 = (DialPointer)i1.clone();
    Differences
    Expression1Expression2Difference
    g2i2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g1i1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (MultipleXYSeriesLabelGenerator)g1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (DialPointer)i1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    i2 = (DialPointer)i1.clone();
    5
    assertTrue(g1 != g2);
    5
    assertTrue(g1 != g2);
    5
    assertTrue(i1 != i2);
    Differences
    Expression1Expression2Difference
    g1i1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g2i2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    5
    assertTrue(i1 != i2);
    6
    assertTrue(g1.getClass() == g2.getClass());
    6
    assertTrue(g1.getClass() == g2.getClass());
    6
    assertTrue(i1.getClass() == i2.getClass());
    Differences
    Expression1Expression2Difference
    g1i1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g2i2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    6
    assertTrue(i1.getClass() == i2.getClass());
    7
    assertTrue(g1.equals(g2));
    7
    assertTrue(g1.equals(g2));
    7
    assertTrue(i1.equals(i2));
    Differences
    Expression1Expression2Difference
    g2i2VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g1i1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g2 cannot be unified with expression i2 , 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 i2 , 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 i1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    7
    assertTrue(i1.equals(i2));
                                                                                                                                    
    8
    MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
    8
    g1.addSeriesLabel(3, "Add3");
    8
    g1.addSeriesLabel(3, "Add3");
    9
    i1.addChangeListener(l1);
    Differences
    Expression1Expression2Difference
    addSeriesLabeladdChangeListenerMETHOD_INVOCATION_NAME_MISMATCH
    g1i1VARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.MultipleXYSeriesLabelGeneratororg.jfree.chart.plot.dial.DialPointerSUBCLASS_TYPE_MISMATCH
    g1.addSeriesLabel(3,"Add3")i1.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 i1.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 i1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    Expression g1 cannot be unified with expression i1 , 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 i1.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 i1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    9
    i1.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(i1.hasListener(l1));
    Preondition Violations
    Unmatched statement assertTrue(i1.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    assertTrue(i1.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(i2.hasListener(l1));
    Preondition Violations
    Unmatched statement assertFalse(i2.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    assertFalse(i2.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 DialPointer.Pin(1) 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 DialPointer.Pin(1) 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 (DialPointer)i1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression g2 cannot be unified with expression i2 , 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 i2 , 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 i1 , 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 i1.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 i1.addChangeListener(l1) is a void method call, and thus it cannot be parameterized
    14Expression g1 cannot be unified with expression i1 , 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 i1.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 i1.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(i1.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(i2.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 i1, i2