IRubyObject tmp = sub.checkStringType(); if (tmp.isNil()) throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given"); pos = strIndex19((RubyString) tmp, pos); pos = subLength(pos);
IRubyObject tmp = sub.checkStringType(); if (tmp.isNil()) throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given"); pos = strIndex((RubyString) tmp, pos);
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 indexCommon19(Ruby, ThreadContext, IRubyObject, int) Method name: IRubyObject indexCommon(Ruby, ThreadContext, IRubyObject, int)
Number of AST nodes: 5 Number of AST nodes: 4
1
IRubyObject tmp = sub.checkStringType();
1
IRubyObject tmp = sub.checkStringType();
2
            if (tmp.isNil()) throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given");
2
            if (tmp.isNil()) throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given");
3
            pos = strIndex19((RubyString) tmp, pos);
3
            pos = strIndex((RubyString) tmp, pos);
4
            pos = subLength(pos);
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 comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    10
    IRubyObject tmp = sub.checkStringType();
    19
    IRubyObject tmp = sub.checkStringType();
    11
    if (tmp.isNil())
    20
    if (tmp.isNil())
    12
    throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given");
    21
    throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given");
    13
    pos = strIndex19((RubyString)tmp, pos);
    13
    pos = strIndex19((RubyString)tmp, pos);
    22
    pos = strIndex((RubyString)tmp, pos);
    Differences
    Expression1Expression2Difference
    strIndex19strIndexMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression strIndex19((RubyString)tmp,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method strIndex19
    Expression strIndex((RubyString)tmp,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method strIndex
    22
    pos = strIndex((RubyString)tmp, pos);
    14
    pos = subLength(pos);
                                                  
    Precondition Violations (2)
    Row Violation
    1Expression strIndex19((RubyString)tmp,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression strIndex((RubyString)tmp,pos) cannot be parameterized, because it has dependencies to/from statements that will be extracted