RubyProc proc = block.getProcObject(); if (proc == null) { proc = RubyProc.newProc(runtime, block, block.type); } return proc;
IRubyObject obj = ref.get(); if (obj == null) { // FIXME weakref.rb also does caller(2) here for the backtrace throw newRefError("Illegal Reference - probably recycled"); } return obj;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/JRubyApplet.java File path: /jruby-1.4.0/src/org/jruby/ext/WeakRef.java
Method name: RubyProc blockToProc(Ruby, Block) Method name: IRubyObject getobj()
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyProc proc = block.getProcObject();
1
IRubyObject obj = ref.get();
2
        
2
        
3
    if (proc == null) {
3
        if (obj == null) {
4
                proc = RubyProc.newProc(runtime, block, block.type);
4
            
5
    
5
// FIXME weakref.rb also does caller(2) here for the backtrace
6
            throw newRefError("Illegal Reference - probably recycled");
6
        }
7
        }
7
        
8
        
8
    return proc;
9
        return obj;
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 in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                              
    1
    IRubyObject obj = ref.get();
    2
    RubyProc proc = block.getProcObject();
                                                                                  
    3
    if (proc == null)
    3
    if (proc == null)
    2
    if (obj == null)
    Differences
    Expression1Expression2Difference
    procobjVARIABLE_NAME_MISMATCH
    org.jruby.RubyProcorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyProc of variable proc does not match with type org.jruby.runtime.builtin.IRubyObject of variable obj
    • Make classes org.jruby.RubyProc and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    2
    if (obj == null)
                                                                                                                                
    3
    throw newRefError("Illegal Reference - probably recycled");
    Preondition Violations
    Unmatched throw newRefError("Illegal Reference - probably recycled");
    3
    throw newRefError("Illegal Reference - probably recycled");
    4
    proc = RubyProc.newProc(runtime, block, block.type);
    4
    proc = RubyProc.newProc(runtime, block, block.type);
    Preondition Violations
    Unmatched statement proc=RubyProc.newProc(runtime,block,block.type); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
                                
    4
    return obj;
    Preondition Violations
    Unmatched return obj;
    4
    return obj;
    5
    return proc;
    5
    return proc;
    Preondition Violations
    Unmatched return proc;
                                  
    Precondition Violations (5)
    Row Violation
    1Type org.jruby.RubyProc of variable proc does not match with type org.jruby.runtime.builtin.IRubyObject of variable obj
    2Unmatched throw newRefError("Illegal Reference - probably recycled");
    3Unmatched statement proc=RubyProc.newProc(runtime,block,block.type); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return obj;
    5Unmatched return proc;