for (int i = 0; i < values.length; i++) { if (i != 0) { sb.append(" | "); } sb.append(type.getMethod("name", (Class[]) null) .invoke(values[i], (Object[]) null)); }
for (int i = 0; i < RMIC_CLASSNAMES.length; i++) { if (i != 0) { buf.append(", "); } buf.append(RMIC_CLASSNAMES[i]); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/AntStructure.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
Method name: void printElementDecl(PrintWriter, Project, String, Class) Method name: boolean execute()
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i = 0; i < values.length; i++) {
1
for (int i = 0; i < RMIC_CLASSNAMES.length; i++) {
2
                                if (i != 0) {
2
                if (i != 0) {
3
                                    sb.append(" | ");
3
                    buf.append(", ");
4
                                }
4
                
5
             
5
}
6
                   sb.append(type.getMethod("name", (Class[]) null)
6
                buf.append(
7
                                          .invoke(values[i], (Object[]) null));
8
                
7
RMIC_CLASSNAMES[i]);
9
            }
8
            }
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
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    70
    for (int i = 0; i < values.length; i++)
    70
    for (int i = 0; i < values.length; i++)
    6
    for (int i = 0; i < RMIC_CLASSNAMES.length; i++)
    Differences
    Expression1Expression2Difference
    valuesRMIC_CLASSNAMESVARIABLE_NAME_MISMATCH
    java.lang.Object[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object[] of variable values does not match with type java.lang.String[] of variable RMIC_CLASSNAMES
    • Make classes java.lang.Object[] and java.lang.String[] extend a common superclass
    6
    for (int i = 0; i < RMIC_CLASSNAMES.length; i++)
    71
    if (i != 0)
    7
    if (i != 0)
    72
    sb.append(" | ");
    72
    sb.append(" | ");
    8
    buf.append(", ");
    Differences
    Expression1Expression2Difference
    " | "", "LITERAL_VALUE_MISMATCH
    sbbufVARIABLE_NAME_MISMATCH
    8
    buf.append(", ");
                                                                        
    9
    buf.append(RMIC_CLASSNAMES[i]);
    Preondition Violations
    Unmatched statement buf.append(RMIC_CLASSNAMES[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    buf.append(RMIC_CLASSNAMES[i]);
    73
    sb.append(type.getMethod("name", (Class[])null).invoke(values[i], (Object[])null));
    73
    sb.append(type.getMethod("name", (Class[])null).invoke(values[i], (Object[])null));
    Preondition Violations
    Unmatched statement sb.append(type.getMethod("name",(Class[])null).invoke(values[i],(Object[])null)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                              
    Precondition Violations (3)
    Row Violation
    1Type java.lang.Object[] of variable values does not match with type java.lang.String[] of variable RMIC_CLASSNAMES
    2Unmatched statement buf.append(RMIC_CLASSNAMES[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement sb.append(type.getMethod("name",(Class[])null).invoke(values[i],(Object[])null)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted