Object[] object = new Double[data.length]; for (int i = 0; i < object.length; i++) { object[i] = new Double(data[i]); } return object;
Number[] result = new Number[data.length]; for (int i = 0; i < data.length; i++) { result[i] = new Double(data[i]); } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/contour/DefaultContourDataset.java File path: /jfreechart-1.0.10/src/org/jfree/data/xy/DefaultHighLowDataset.java
Method name: Object[] formObjectArray(double[]) Method name: Number[] createNumberArray(double[])
Number of AST nodes: 4 Number of AST nodes: 4
1
Object[] object = new Double[data.length];
1
Number[] result = new Number[data.length];
2
        for (int i = 0; i < object.length; i++) {
2
        for (int i = 0; i < data.length; i++) {
3
            object[i] = new Double(data[i]);
3
            result[i] = new Double(data[i]);
4
        }
4
        }
5
        return object;
5
        return result;
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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                          
    1
    Number[] result = new Number[data.length];
    1
    Object[] object = new Double[data.length];
                                                                                          
    2
    for (int i = 0; i < object.length; i++)
    2
    for (int i = 0; i < object.length; i++)
    2
    for (int i = 0; i < data.length; i++)
    Differences
    Expression1Expression2Difference
    objectdataVARIABLE_NAME_MISMATCH
    java.lang.Object[]double[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable object.length does not match with type int of variable data.length
    • Make classes java.lang.Object[] and double[] extend a common superclass
    2
    for (int i = 0; i < data.length; i++)
                                                                      
    3
    result[i] = new Double(data[i]);
    Preondition Violations
    Unmatched statement result[i]=new Double(data[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    result[i] = new Double(data[i]);
    3
    object[i] = new Double(data[i]);
    3
    object[i] = new Double(data[i]);
    Preondition Violations
    Unmatched statement object[i]=new Double(data[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
                                      
    4
    return result;
    Preondition Violations
    Unmatched return result;
    4
    return result;
    4
    return object;
    4
    return object;
    Preondition Violations
    Unmatched return object;
                                      
    Precondition Violations (6)
    Row Violation
    1Type int of variable object.length does not match with type int of variable data.length
    2Unmatched statement result[i]=new Double(data[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement object[i]=new Double(data[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return result;
    5Unmatched return object;
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero