StringBuilder result = new StringBuilder(); result.append(nameOnInspection()); result.append("("); Class[] parameterTypes = getParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { result.append(parameterTypes[i].getName()); if (i < parameterTypes.length - 1) { result.append(','); } } result.append(")>"); return getRuntime().newString(result.toString());
StringBuilder result = new StringBuilder(); result.append(nameOnInspection()); Class<?>[] parameterTypes = getParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { result.append(parameterTypes[i].getName()); if (i < parameterTypes.length - 1) { result.append(','); } } result.append(")>"); return getRuntime().newString(result.toString());
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/proxy/JavaProxyClass.java File path: /jruby-1.4.0/src/org/jruby/javasupport/proxy/JavaProxyConstructor.java
Method name: IRubyObject inspect() Method name: IRubyObject inspect()
Number of AST nodes: 10 Number of AST nodes: 9
1
StringBuilder result = new StringBuilder();
1
StringBuilder result = new StringBuilder();
2
            result.append(nameOnInspection());
2
        result.append(nameOnInspection());
3
            result.append("(");
3
        
4
            Class[] parameterTypes = getParameterTypes();
4
Class<?>[] parameterTypes = getParameterTypes();
5
            for (int i = 0; i < parameterTypes.length; i++) {
5
        for (int i = 0; i < parameterTypes.length; i++) {
6
                result.append(parameterTypes[i].getName());
6
            result.append(parameterTypes[i].getName());
7
                if (i < parameterTypes.length - 1) {
7
            if (i < parameterTypes.length - 1) {
8
                    result.append(',');
8
                result.append(',');
9
                }
9
            
10
            }
10
}
11
    
11
        }
12
        result.append(")>");
12
        result.append(")>");
13
            return getRuntime().newString(result.toString());
13
        return getRuntime().newString(result.toString());
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    StringBuilder result = new StringBuilder();
    1
    StringBuilder result = new StringBuilder();
    2
    result.append(nameOnInspection());
    2
    result.append(nameOnInspection());
    Preondition Violations
    Unmatched statement result.append(nameOnInspection()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                              
    3
    result.append("(");
    3
    result.append("(");
    2
    result.append(nameOnInspection());
    Differences
    Expression1Expression2Difference
    "("nameOnInspection()TYPE_COMPATIBLE_REPLACEMENT
    2
    result.append(nameOnInspection());
                                                                                                      
    3
    Class<?>[] parameterTypes = getParameterTypes();
    4
    Class[] parameterTypes = getParameterTypes();
                                                                                                
    5
    for (int i = 0; i < parameterTypes.length; i++)
    5
    for (int i = 0; i < parameterTypes.length; i++)
    4
    for (int i = 0; i < parameterTypes.length; i++)
    Differences
    Expression1Expression2Difference
    java.lang.Class[]java.lang.Class[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable parameterTypes does not match with type java.lang.Class<?>[] of variable parameterTypes
    • Make classes java.lang.Class[] and java.lang.Class[] extend a common superclass
    4
    for (int i = 0; i < parameterTypes.length; i++)
    6
    result.append(parameterTypes[i].getName());
    6
    result.append(parameterTypes[i].getName());
    5
    result.append(parameterTypes[i].getName());
    Differences
    Expression1Expression2Difference
    java.lang.Class[]java.lang.Class[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable parameterTypes does not match with type java.lang.Class<?>[] of variable parameterTypes
    • Make classes java.lang.Class[] and java.lang.Class[] extend a common superclass
    5
    result.append(parameterTypes[i].getName());
    7
    if (i < parameterTypes.length - 1)
    7
    if (i < parameterTypes.length - 1)
    6
    if (i < parameterTypes.length - 1)
    Differences
    Expression1Expression2Difference
    java.lang.Class[]java.lang.Class[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable parameterTypes does not match with type java.lang.Class<?>[] of variable parameterTypes
    • Make classes java.lang.Class[] and java.lang.Class[] extend a common superclass
    6
    if (i < parameterTypes.length - 1)
    8
    result.append(',');
    7
    result.append(',');
    9
    result.append(")>");
    8
    result.append(")>");
    10
    return getRuntime().newString(result.toString());
    9
    return getRuntime().newString(result.toString());
    Precondition Violations (5)
    Row Violation
    1Unmatched statement result.append(nameOnInspection()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type java.lang.Class[] of variable parameterTypes does not match with type java.lang.Class<?>[] of variable parameterTypes
    3Type java.lang.Class[] of variable parameterTypes does not match with type java.lang.Class<?>[] of variable parameterTypes
    4Type java.lang.Class[] of variable parameterTypes does not match with type java.lang.Class<?>[] of variable parameterTypes
    5Clone fragment #1 returns variables result , while Clone fragment #2 returns variables