setBinmodeIfPossible(in); if (in instanceof RubyIO) { return ((RubyIO) in).getInStream(); } return new IOInputStream(in);
setBinmodeIfPossible(out); if (out instanceof RubyIO) { return ((RubyIO) out).getOutStream(); } return new IOOutputStream(out);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyMarshal.java File path: /jruby-1.4.0/src/org/jruby/RubyMarshal.java
Method name: InputStream inputStream(IRubyObject) Method name: OutputStream outputStream(IRubyObject)
Number of AST nodes: 4 Number of AST nodes: 4
1
setBinmodeIfPossible(in);
1
setBinmodeIfPossible(out);
2
        if (in instanceof RubyIO) {
2
        if (out instanceof RubyIO) {
3
            return ((RubyIO) in).getInStream();
3
            return ((RubyIO) out).getOutStream();
4
        }
4
        }
5
        return new IOInputStream(in);
5
        return new IOOutputStream(out);
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.1
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    setBinmodeIfPossible(in);
    1
    setBinmodeIfPossible(in);
    1
    setBinmodeIfPossible(out);
    Differences
    Expression1Expression2Difference
    inoutVARIABLE_NAME_MISMATCH
    1
    setBinmodeIfPossible(out);
    2
    if (in instanceof RubyIO)
    2
    if (in instanceof RubyIO)
    2
    if (out instanceof RubyIO)
    Differences
    Expression1Expression2Difference
    inoutVARIABLE_NAME_MISMATCH
    2
    if (out instanceof RubyIO)
                                                                                  
    3
    return ((RubyIO)out).getOutStream();
    Preondition Violations
    Unmatched return ((RubyIO)out).getOutStream();
    3
    return ((RubyIO)out).getOutStream();
    3
    return ((RubyIO)in).getInStream();
    3
    return ((RubyIO)in).getInStream();
    Preondition Violations
    Unmatched return ((RubyIO)in).getInStream();
                                                                              
                                                                        
    4
    return new IOOutputStream(out);
    Preondition Violations
    Unmatched return new IOOutputStream(out);
    4
    return new IOOutputStream(out);
    4
    return new IOInputStream(in);
    4
    return new IOInputStream(in);
    Preondition Violations
    Unmatched return new IOInputStream(in);
                                                                    
    Precondition Violations (4)
    Row Violation
    1Unmatched return ((RubyIO)out).getOutStream();
    2Unmatched return ((RubyIO)in).getInStream();
    3Unmatched return new IOOutputStream(out);
    4Unmatched return new IOInputStream(in);