RubyString str = getLastlineString(context, context.getRuntime()); RubyString dup = (RubyString) str.dup(); if (dup.chomp_bang(context, arg0).isNil()) { return str; } context.getCurrentScope().setLastLine(dup); return dup;
RubyString str = getLastlineString(context, context.getRuntime()); RubyString dup = (RubyString) str.dup(); if (dup.chomp_bang(args).isNil()) { return str; } context.getCurrentScope().setLastLine(dup); return dup;
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 chomp(ThreadContext, IRubyObject, IRubyObject) Method name: IRubyObject chomp(ThreadContext, IRubyObject, IRubyObject[], Block)
Number of AST nodes: 6 Number of AST nodes: 6
1
RubyString str = getLastlineString(context, context.getRuntime());
1
RubyString str = getLastlineString(context, context.getRuntime());
2
        RubyString dup = (RubyString) str.dup();
2
        RubyString dup = (RubyString) str.dup();
3
        if (dup.chomp_bang(context, arg0).isNil()) {
3
        if (dup.chomp_bang(args).isNil()) {
4
            return str;
4
            return str;
5
        } 
5
        } 
6
        context.getCurrentScope().setLastLine(dup);
6
        context.getCurrentScope().setLastLine(dup);
7
        return dup;
7
        return dup;
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 comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RubyString str = getLastlineString(context, context.getRuntime());
    1
    RubyString str = getLastlineString(context, context.getRuntime());
    2
    RubyString dup = (RubyString)str.dup();
    2
    RubyString dup = (RubyString)str.dup();
    3
    if (dup.chomp_bang(context, arg0).isNil())
    3
    if (dup.chomp_bang(context, arg0).isNil())
    3
    if (dup.chomp_bang(args).isNil())
    Differences
    Expression1Expression2Difference
    dup.chomp_bang(context,arg0)dup.chomp_bang(args)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression dup.chomp_bang(context,arg0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dup.chomp_bang(args) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (dup.chomp_bang(args).isNil())
    4
    return str;
    4
    return str;
    5
    context.getCurrentScope().setLastLine(dup);
    5
    context.getCurrentScope().setLastLine(dup);
    6
    return dup;
    6
    return dup;
    Precondition Violations (2)
    Row Violation
    1Expression dup.chomp_bang(context,arg0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression dup.chomp_bang(args) cannot be parameterized, because it has dependencies to/from statements that will be extracted