RubyArray result = getRuntime().newArray(classes.length); for (int i = 0; i < classes.length; i++) { result.append(JavaClass.get(getRuntime(), classes[i])); } return result;
RubyArray result = getRuntime().newArray(constructors.length); for (int i = 0; i < constructors.length; i++) { result.append(constructors[i]); } return result;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/proxy/JavaProxyReflectionObject.java File path: /jruby-1.4.0/src/org/jruby/javasupport/proxy/JavaProxyReflectionObject.java
Method name: RubyArray buildRubyArray(Class[]) Method name: RubyArray buildRubyArray(IRubyObject[])
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyArray result = getRuntime().newArray(classes.length);
1
RubyArray result = getRuntime().newArray(constructors.length);
2
        for (int i = 0; i < classes.length; i++) {
2
        for (int i = 0; i < constructors.length; i++) {
3
            result.append(JavaClass.get(getRuntime(), classes[i]));
3
            result.append(constructors[i]);
4
        }
4
        }
5
        return result;
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 declared in the same class
Number of node comparisons8
  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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RubyArray result = getRuntime().newArray(classes.length);
    1
    RubyArray result = getRuntime().newArray(classes.length);
    1
    RubyArray result = getRuntime().newArray(constructors.length);
    Differences
    Expression1Expression2Difference
    classesconstructorsVARIABLE_NAME_MISMATCH
    java.lang.Class[]org.jruby.runtime.builtin.IRubyObject[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable classes does not match with type org.jruby.runtime.builtin.IRubyObject[] of variable constructors
    • Make classes java.lang.Class[] and org.jruby.runtime.builtin.IRubyObject[] extend a common superclass
    1
    RubyArray result = getRuntime().newArray(constructors.length);
    2
    for (int i = 0; i < classes.length; i++)
    2
    for (int i = 0; i < classes.length; i++)
    2
    for (int i = 0; i < constructors.length; i++)
    Differences
    Expression1Expression2Difference
    classesconstructorsVARIABLE_NAME_MISMATCH
    java.lang.Class[]org.jruby.runtime.builtin.IRubyObject[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable classes does not match with type org.jruby.runtime.builtin.IRubyObject[] of variable constructors
    • Make classes java.lang.Class[] and org.jruby.runtime.builtin.IRubyObject[] extend a common superclass
    2
    for (int i = 0; i < constructors.length; i++)
                                                                        
    3
    result.append(constructors[i]);
    Preondition Violations
    Unmatched statement result.append(constructors[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    result.append(constructors[i]);
    3
    result.append(JavaClass.get(getRuntime(), classes[i]));
    3
    result.append(JavaClass.get(getRuntime(), classes[i]));
    Preondition Violations
    Unmatched statement result.append(JavaClass.get(getRuntime(),classes[i])); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                      
    4
    return result;
    4
    return result;
    Precondition Violations (5)
    Row Violation
    1Type java.lang.Class[] of variable classes does not match with type org.jruby.runtime.builtin.IRubyObject[] of variable constructors
    2Type java.lang.Class[] of variable classes does not match with type org.jruby.runtime.builtin.IRubyObject[] of variable constructors
    3Unmatched statement result.append(constructors[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement result.append(JavaClass.get(getRuntime(),classes[i])); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables result, i , while Clone fragment #2 returns variables result, i