sb.append("("); for (int i = 0; i < values.length; i++) { if (i != 0) { sb.append(" | "); } sb.append(values[i]); } sb.append(") ");
sb.append('('); 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)); } sb.append(") ");
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/AntStructure.java
Method name: void printElementDecl(PrintWriter, Project, String, Class) Method name: void printElementDecl(PrintWriter, Project, String, Class)
Number of AST nodes: 6 Number of AST nodes: 6
1
sb.append("(");
1
sb.append('(');
2
                            for (int i = 0; i < values.length; i++) {
2
                            for (int i = 0; i < values.length; i++) {
3
                                if (i != 0) {
3
                                if (i != 0) {
4
                                    sb.append(" | ");
4
                                    sb.append(" | ");
5
                                }
5
                                }
6
                                sb.append(values[i]
6
                                sb.append(type.getMethod("name", (Class[]) null)
7
);
7
                                          .invoke(values[i], (Object[]) null));
8
                            }
8
                            }
9
                            sb.append(") ");
9
                            sb.append(") ");
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.5
Clones locationClones are in the same method
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                          
    69
    sb.append('(');
    58
    sb.append("(");
    58
    sb.append("(");
    74
    sb.append(") ");
    Differences
    Expression1Expression2Difference
    "("") "LITERAL_VALUE_MISMATCH
    74
    sb.append(") ");
    59
    for (int i = 0; i < values.length; i++)
    59
    for (int i = 0; i < values.length; i++)
    70
    for (int i = 0; i < values.length; i++)
    Differences
    Expression1Expression2Difference
    java.lang.String[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable values does not match with type java.lang.Object[] of variable values
    • Make classes java.lang.String[] and java.lang.Object[] extend a common superclass
    70
    for (int i = 0; i < values.length; i++)
    60
    if (i != 0)
    71
    if (i != 0)
    61
    sb.append(" | ");
    72
    sb.append(" | ");
    62
    sb.append(values[i]);
    62
    sb.append(values[i]);
    Preondition Violations
    Unmatched statement sb.append(values[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                      
                                                                                                                                                                              
    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
    73
    sb.append(type.getMethod("name", (Class[])null).invoke(values[i], (Object[])null));
    63
    sb.append(") ");
    63
    sb.append(") ");
    Preondition Violations
    Unmatched statement sb.append(") "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                            
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String[] of variable values does not match with type java.lang.Object[] of variable values
    2Unmatched statement sb.append(values[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
    4Unmatched statement sb.append(") "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted