RubyArray result = getRuntime().newArray(constructors.length); for (int i = 0; i < constructors.length; i++) { result.append(constructors[i]); } return result;
RubyArray result = getRuntime().newArray(constructors.length); for (int i = 0; i < constructors.length; i++) { result.append(new JavaConstructor(getRuntime(), 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/JavaClass.java
Method name: RubyArray buildRubyArray(IRubyObject[]) Method name: RubyArray buildConstructors(Constructor[])
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyArray result = getRuntime().newArray(constructors.length);
1
RubyArray result = getRuntime().newArray(constructors.length);
2
        for (int i = 0; i < constructors.length; i++) {
2
        for (int i = 0; i < constructors.length; i++) {
3
            result.append(constructors[i]);
3
            result.append(new JavaConstructor(getRuntime(), 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.3
Clones locationClones are in different classes having the same super 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(constructors.length);
    1
    RubyArray result = getRuntime().newArray(constructors.length);
    1
    RubyArray result = getRuntime().newArray(constructors.length);
    Differences
    Expression1Expression2Difference
    org.jruby.runtime.builtin.IRubyObject[]java.lang.reflect.Constructor[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.builtin.IRubyObject[] of variable constructors does not match with type java.lang.reflect.Constructor<?>[] of variable constructors
    • Make classes org.jruby.runtime.builtin.IRubyObject[] and java.lang.reflect.Constructor[] extend a common superclass
    1
    RubyArray result = getRuntime().newArray(constructors.length);
    2
    for (int i = 0; i < constructors.length; i++)
    2
    for (int i = 0; i < constructors.length; i++)
    2
    for (int i = 0; i < constructors.length; i++)
    Differences
    Expression1Expression2Difference
    org.jruby.runtime.builtin.IRubyObject[]java.lang.reflect.Constructor[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.builtin.IRubyObject[] of variable constructors does not match with type java.lang.reflect.Constructor<?>[] of variable constructors
    • Make classes org.jruby.runtime.builtin.IRubyObject[] and java.lang.reflect.Constructor[] extend a common superclass
    2
    for (int i = 0; i < constructors.length; i++)
                                                                                                                                            
    3
    result.append(new JavaConstructor(getRuntime(), constructors[i]));
    Preondition Violations
    Unmatched statement result.append(new JavaConstructor(getRuntime(),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(new JavaConstructor(getRuntime(), constructors[i]));
    3
    result.append(constructors[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
                                                                        
    4
    return result;
    4
    return result;
    Precondition Violations (5)
    Row Violation
    1Type org.jruby.runtime.builtin.IRubyObject[] of variable constructors does not match with type java.lang.reflect.Constructor<?>[] of variable constructors
    2Type org.jruby.runtime.builtin.IRubyObject[] of variable constructors does not match with type java.lang.reflect.Constructor<?>[] of variable constructors
    3Unmatched statement result.append(new JavaConstructor(getRuntime(),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(constructors[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