Ruby runtime = context.getRuntime(); if (value.realSize == 0) return runtime.getNil(); IRubyObject rsObj = runtime.getGlobalVariables().get("$/"); if (rsObj == runtime.getGlobalVariables().getDefaultSeparator()) return smartChopBangCommon(runtime); return chompBangCommon(runtime, rsObj);
Ruby runtime = context.getRuntime(); if (value.realSize == 0) return runtime.getNil(); IRubyObject rsObj = runtime.getGlobalVariables().get("$/"); if (rsObj == runtime.getGlobalVariables().getDefaultSeparator()) return smartChopBangCommon19(runtime); return chompBangCommon19(runtime, rsObj);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyString.java File path: /jruby-1.4.0/src/org/jruby/RubyString.java
Method name: IRubyObject chomp_bang(ThreadContext) Method name: IRubyObject chomp_bang19(ThreadContext)
Number of AST nodes: 7 Number of AST nodes: 7
1
Ruby runtime = context.getRuntime();
1
Ruby runtime = context.getRuntime();
2
        if (value.realSize == 0) return runtime.getNil();
2
        if (value.realSize == 0) return runtime.getNil();
3
        IRubyObject rsObj = runtime.getGlobalVariables().get("$/");
3
        IRubyObject rsObj = runtime.getGlobalVariables().get("$/");
4
        if (rsObj == runtime.getGlobalVariables().getDefaultSeparator()) return smartChopBangCommon(runtime);
4
        if (rsObj == runtime.getGlobalVariables().getDefaultSeparator()) return smartChopBangCommon19(runtime);
5
        return chompBangCommon(runtime, rsObj);
5
        return chompBangCommon19(runtime, rsObj);
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.6
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Ruby runtime = context.getRuntime();
    1
    Ruby runtime = context.getRuntime();
    2
    if (value.realSize == 0)
    2
    if (value.realSize == 0)
    3
    return runtime.getNil();
    3
    return runtime.getNil();
    4
    IRubyObject rsObj = runtime.getGlobalVariables().get("$/");
    4
    IRubyObject rsObj = runtime.getGlobalVariables().get("$/");
    5
    if (rsObj == runtime.getGlobalVariables().getDefaultSeparator())
    5
    if (rsObj == runtime.getGlobalVariables().getDefaultSeparator())
    6
    return smartChopBangCommon(runtime);
    6
    return smartChopBangCommon(runtime);
    6
    return smartChopBangCommon19(runtime);
    Differences
    Expression1Expression2Difference
    smartChopBangCommonsmartChopBangCommon19METHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression smartChopBangCommon(runtime) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method smartChopBangCommon
    Expression smartChopBangCommon19(runtime) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method smartChopBangCommon19
    6
    return smartChopBangCommon19(runtime);
    7
    return chompBangCommon(runtime, rsObj);
    7
    return chompBangCommon(runtime, rsObj);
    7
    return chompBangCommon19(runtime, rsObj);
    Differences
    Expression1Expression2Difference
    chompBangCommonchompBangCommon19METHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression chompBangCommon(runtime,rsObj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method chompBangCommon
    Expression chompBangCommon19(runtime,rsObj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method chompBangCommon19
    7
    return chompBangCommon19(runtime, rsObj);
    Precondition Violations (4)
    Row Violation
    1Expression smartChopBangCommon(runtime) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression smartChopBangCommon19(runtime) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression chompBangCommon(runtime,rsObj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression chompBangCommon19(runtime,rsObj) cannot be parameterized, because it has dependencies to/from statements that will be extracted