IRubyObject match = context.getCurrentScope().getBackRef(context.getRuntime()); if (match instanceof RubyMatchData) ((RubyMatchData)match).use(); return match;
IRubyObject backref = context.getCurrentScope().getBackRef(runtime); if (backref instanceof RubyMatchData) ((RubyMatchData)backref).use(); return backref;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java File path: /jruby-1.4.0/src/org/jruby/javasupport/util/RuntimeHelpers.java
Method name: IRubyObject last_match_s(ThreadContext, IRubyObject) Method name: IRubyObject getBackref(Ruby, ThreadContext)
Number of AST nodes: 4 Number of AST nodes: 4
1
IRubyObject match = context.getCurrentScope().getBackRef(context.getRuntime());
1
IRubyObject backref = context.getCurrentScope().getBackRef(runtime);
2
        if (match instanceof RubyMatchData) ((RubyMatchData)match).use();
2
        if (backref instanceof RubyMatchData) ((RubyMatchData)backref).use();
3
        return match;
3
        return backref;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons8
  1. {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)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    IRubyObject match = context.getCurrentScope().getBackRef(context.getRuntime());
    1
    IRubyObject match = context.getCurrentScope().getBackRef(context.getRuntime());
    1
    IRubyObject backref = context.getCurrentScope().getBackRef(runtime);
    Differences
    Expression1Expression2Difference
    matchbackrefVARIABLE_NAME_MISMATCH
    context.getRuntime()runtimeTYPE_COMPATIBLE_REPLACEMENT
    1
    IRubyObject backref = context.getCurrentScope().getBackRef(runtime);
    2
    if (match instanceof RubyMatchData)
    2
    if (match instanceof RubyMatchData)
    2
    if (backref instanceof RubyMatchData)
    Differences
    Expression1Expression2Difference
    matchbackrefVARIABLE_NAME_MISMATCH
    2
    if (backref instanceof RubyMatchData)
    3
    ((RubyMatchData)match).use();
    3
    ((RubyMatchData)match).use();
    3
    ((RubyMatchData)backref).use();
    Differences
    Expression1Expression2Difference
    matchbackrefVARIABLE_NAME_MISMATCH
    3
    ((RubyMatchData)backref).use();
    4
    return match;
    4
    return match;
    4
    return backref;
    Differences
    Expression1Expression2Difference
    matchbackrefVARIABLE_NAME_MISMATCH
    4
    return backref;
    Precondition Violations (0)
    Row Violation