if (arg instanceof RubyRange) { int[] beglen = ((RubyRange) arg).begLenInt(realLength, 1); return fillCommon(context, beglen[0], beglen[1], block); } int beg; return fillCommon(context, beg = fillBegin(arg), fillLen(beg, null), block);
if (arg2 instanceof RubyRange) { int[] beglen = ((RubyRange) arg2).begLenInt(realLength, 1); return fillCommon(context, beglen[0], beglen[1], arg1); } int beg; return fillCommon(context, beg = fillBegin(arg2), fillLen(beg, null), arg1);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyArray.java File path: /jruby-1.4.0/src/org/jruby/RubyArray.java
Method name: IRubyObject fill(ThreadContext, IRubyObject, Block) Method name: IRubyObject fill(ThreadContext, IRubyObject, IRubyObject, Block)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (arg instanceof RubyRange) {
1
if (arg2 instanceof RubyRange) {
2
                int[] beglen = ((RubyRange) arg).begLenInt(realLength, 1);
2
                int[] beglen = ((RubyRange) arg2).begLenInt(realLength, 1);
3
                return fillCommon(context, beglen[0], beglen[1], block);
3
                return fillCommon(context, beglen[0], beglen[1], arg1);
4
            }
4
            }
5
            int beg;
5
            int beg;
6
            return fillCommon(context, beg = fillBegin(arg), fillLen(beg, null),  block);
6
            return fillCommon(context, beg = fillBegin(arg2), fillLen(beg, null), arg1);
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.1
Clones locationClones are declared in the same class
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (arg instanceof RubyRange)
    2
    if (arg instanceof RubyRange)
    4
    if (arg2 instanceof RubyRange)
    Differences
    Expression1Expression2Difference
    argarg2VARIABLE_NAME_MISMATCH
    4
    if (arg2 instanceof RubyRange)
    3
    int[] beglen = ((RubyRange)arg).begLenInt(realLength, 1);
    3
    int[] beglen = ((RubyRange)arg).begLenInt(realLength, 1);
    5
    int[] beglen = ((RubyRange)arg2).begLenInt(realLength, 1);
    Differences
    Expression1Expression2Difference
    argarg2VARIABLE_NAME_MISMATCH
    5
    int[] beglen = ((RubyRange)arg2).begLenInt(realLength, 1);
    4
    return fillCommon(context, beglen[0], beglen[1], block);
    4
    return fillCommon(context, beglen[0], beglen[1], block);
    6
    return fillCommon(context, beglen[0], beglen[1], arg1);
    Differences
    Expression1Expression2Difference
    blockarg1VARIABLE_NAME_MISMATCH
    org.jruby.runtime.Blockorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg1
    • Make classes org.jruby.runtime.Block and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    6
    return fillCommon(context, beglen[0], beglen[1], arg1);
    5
    int beg;
    7
    int beg;
    6
    return fillCommon(context, beg = fillBegin(arg), fillLen(beg, null), block);
    6
    return fillCommon(context, beg = fillBegin(arg), fillLen(beg, null), block);
    8
    return fillCommon(context, beg = fillBegin(arg2), fillLen(beg, null), arg1);
    Differences
    Expression1Expression2Difference
    argarg2VARIABLE_NAME_MISMATCH
    blockarg1VARIABLE_NAME_MISMATCH
    org.jruby.runtime.Blockorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg1
    • Make classes org.jruby.runtime.Block and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    8
    return fillCommon(context, beg = fillBegin(arg2), fillLen(beg, null), arg1);
    Precondition Violations (2)
    Row Violation
    1Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg1
    2Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg1