PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", "ToolTip", "URL"); StandardEntityCollection c1 = new StandardEntityCollection(); c1.add(e1); StandardEntityCollection c2 = null; try { c2 = (StandardEntityCollection) c1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(c1 != c2); assertTrue(c1.getClass() == c2.getClass()); assertTrue(c1.equals(c2)); // check independence c1.clear(); assertFalse(c1.equals(c2)); c2.clear(); assertTrue(c1.equals(c2));
XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection(); XYIntervalSeries s1 = new XYIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5); XYIntervalSeriesCollection c2 = null; try { c2 = (XYIntervalSeriesCollection) c1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(c1 != c2); assertTrue(c1.getClass() == c2.getClass()); assertTrue(c1.equals(c2)); // check independence c1.addSeries(new XYIntervalSeries("Empty")); assertFalse(c1.equals(c2)); c2.addSeries(new XYIntervalSeries("Empty")); assertTrue(c1.equals(c2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/StandardEntityCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYIntervalSeriesCollectionTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 13 Number of AST nodes: 13
1
PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 
2
                2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", 
3
                "ToolTip", "URL");
4
        StandardEntityCollection c1 = new StandardEntityCollection(
1
XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
5
);
2
        XYIntervalSeries s1 = new XYIntervalSeries("Series");
6
        c1.add(e1);
3
        s1.add(
7
        StandardEntity
4
1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
8
Collection c2 = null;
5
        XYIntervalSeriesCollection c2 = null;
9
        try {
6
        try {
10
            c2 = (StandardEntityCollection) c1.clone();
7
            c2 = (XYIntervalSeriesCollection) c1.clone();
11
        }
8
        }
12
        catch (CloneNotSupportedException e) {
9
        catch (CloneNotSupportedException e) {
13
            e.printStackTrace();
10
            e.printStackTrace();
14
        }
11
        }
15
        assertTrue(c1 != c2);
12
        assertTrue(c1 != c2);
16
        assertTrue(c1.getClass() == c2.getClass());
13
        assertTrue(c1.getClass() == c2.getClass());
17
        assertTrue(c1.equals(c2));
14
        assertTrue(c1.equals(c2));
18
        
19
        // check independence
15
        // check independence
20
        c1.clear();
16
        c1.addSeries(new XYIntervalSeries("Empty"));
21
        assertFalse(c1.equals(c2));
17
        assertFalse(c1.equals(c2));
22
        c2.clear();
18
        c2.addSeries(new XYIntervalSeries("Empty"));
23
        assertTrue(c1.equals(c2));
19
        assertTrue(c1.equals(c2));
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 statements11
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)33.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", "ToolTip", "URL");
    1
    PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", "ToolTip", "URL");
    4
    XYIntervalSeriesCollection c2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.PieSectionEntityorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    e1c2VARIABLE_NAME_MISMATCH
    org.jfree.chart.entity.PieSectionEntityorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL")nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    XYIntervalSeriesCollection c2 = null;
    2
    StandardEntityCollection c1 = new StandardEntityCollection();
    2
    StandardEntityCollection c1 = new StandardEntityCollection();
    1
    XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new StandardEntityCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
                                                                                                                
    2
    XYIntervalSeries s1 = new XYIntervalSeries("Series");
                                                                          
    3
    s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
    Preondition Violations
    Unmatched statement s1.add(1.0,1.1,1.2,1.3,1.4,1.5); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
    3
    c1.add(e1);
    3
    c1.add(e1);
    Preondition Violations
    Unmatched statement c1.add(e1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                
    4
    StandardEntityCollection c2 = null;
                                                                            
    5
    try
    5
    try
    6
    c2 = (StandardEntityCollection)c1.clone();
    6
    c2 = (StandardEntityCollection)c1.clone();
    6
    c2 = (XYIntervalSeriesCollection)c1.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (StandardEntityCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (XYIntervalSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    c2 = (XYIntervalSeriesCollection)c1.clone();
    7
    assertTrue(c1 != c2);
    7
    assertTrue(c1 != c2);
    7
    assertTrue(c1 != c2);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    7
    assertTrue(c1 != c2);
    8
    assertTrue(c1.getClass() == c2.getClass());
    8
    assertTrue(c1.getClass() == c2.getClass());
    8
    assertTrue(c1.getClass() == c2.getClass());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    8
    assertTrue(c1.getClass() == c2.getClass());
    9
    assertTrue(c1.equals(c2));
    9
    assertTrue(c1.equals(c2));
    9
    assertTrue(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    9
    assertTrue(c1.equals(c2));
    10
    c1.clear();
    10
    c1.clear();
    10
    c1.addSeries(new XYIntervalSeries("Empty"));
    Differences
    Expression1Expression2Difference
    clearaddSeriesMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    c1.clear()c1.addSeries(new XYIntervalSeries("Empty"))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c1.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c1.clear() is a void method call, and thus it cannot be parameterized
    Expression c1.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void addSeries(org.jfree.data.xy.XYIntervalSeries)
    Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c1.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c1.clear() is a void method call, and thus it cannot be parameterized
    Expression c1.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    10
    c1.addSeries(new XYIntervalSeries("Empty"));
    11
    assertFalse(c1.equals(c2));
    11
    assertFalse(c1.equals(c2));
    11
    assertFalse(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    11
    assertFalse(c1.equals(c2));
    12
    c2.clear();
    12
    c2.clear();
    12
    c2.addSeries(new XYIntervalSeries("Empty"));
    Differences
    Expression1Expression2Difference
    clearaddSeriesMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    c2.clear()c2.addSeries(new XYIntervalSeries("Empty"))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c2.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c2.clear() is a void method call, and thus it cannot be parameterized
    Expression c2.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void addSeries(org.jfree.data.xy.XYIntervalSeries)
    Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c2.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c2.clear() is a void method call, and thus it cannot be parameterized
    Expression c2.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    12
    c2.addSeries(new XYIntervalSeries("Empty"));
    13
    assertTrue(c1.equals(c2));
    13
    assertTrue(c1.equals(c2));
    13
    assertTrue(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    13
    assertTrue(c1.equals(c2));
    Precondition Violations (35)
    Row Violation
    1Expression new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new StandardEntityCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new XYIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched statement s1.add(1.0,1.1,1.2,1.3,1.4,1.5); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement c1.add(e1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Expression (StandardEntityCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (XYIntervalSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    9Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    10Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    11Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression c1.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression c1.clear() is a void method call, and thus it cannot be parameterized
    14Expression c1.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    15Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void addSeries(org.jfree.data.xy.XYIntervalSeries)
    16Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression c1.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression c1.clear() is a void method call, and thus it cannot be parameterized
    19Expression c1.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    20Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    21Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    22Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    23Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Expression c2.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Expression c2.clear() is a void method call, and thus it cannot be parameterized
    26Expression c2.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    27Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void addSeries(org.jfree.data.xy.XYIntervalSeries)
    28Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Expression c2.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30Expression c2.clear() is a void method call, and thus it cannot be parameterized
    31Expression c2.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized
    32Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    33Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    34Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    35Clone fragment #1 returns variables e1, c1 , while Clone fragment #2 returns variables