RubyString str = (RubyString) getLastlineString(context, context.getRuntime()).dup(); if (!str.sub_bang(context, args, block).isNil()) { context.getCurrentScope().setLastLine(str); } return str;
RubyString str = (RubyString) getLastlineString(context, context.getRuntime()).dup(); if (!str.sub_bang(context, arg0, block).isNil()) { context.getCurrentScope().setLastLine(str); } return str;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyKernel.java File path: /jruby-1.4.0/src/org/jruby/RubyKernel.java
Method name: IRubyObject sub(ThreadContext, IRubyObject, IRubyObject[], Block) Method name: IRubyObject sub(ThreadContext, IRubyObject, IRubyObject, Block)
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyString str = (RubyString) getLastlineString(context, context.getRuntime()).dup();
1
RubyString str = (RubyString) getLastlineString(context, context.getRuntime()).dup();
2
        if (!str.sub_bang(context, args, block).isNil()) {
2
        if (!str.sub_bang(context, arg0, block).isNil()) {
3
            context.getCurrentScope().setLastLine(str);
3
            context.getCurrentScope().setLastLine(str);
4
        }
4
        }
5
        return str;
5
        return str;
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 declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RubyString str = (RubyString)getLastlineString(context, context.getRuntime()).dup();
    1
    RubyString str = (RubyString)getLastlineString(context, context.getRuntime()).dup();
    2
    if (!str.sub_bang(context, args, block).isNil())
    2
    if (!str.sub_bang(context, args, block).isNil())
    2
    if (!str.sub_bang(context, arg0, block).isNil())
    Differences
    Expression1Expression2Difference
    argsarg0VARIABLE_NAME_MISMATCH
    org.jruby.runtime.builtin.IRubyObject[]org.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.builtin.IRubyObject[] of variable args does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg0
    • Make classes org.jruby.runtime.builtin.IRubyObject[] and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    2
    if (!str.sub_bang(context, arg0, block).isNil())
    3
    context.getCurrentScope().setLastLine(str);
    3
    context.getCurrentScope().setLastLine(str);
    4
    return str;
    4
    return str;
    Precondition Violations (1)
    Row Violation
    1Type org.jruby.runtime.builtin.IRubyObject[] of variable args does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg0