RubyClass selfType = pollAndGetClass(context, self); CacheEntry myCache = cache; if (myCache.typeOk(selfType)) { return myCache.method.call(context, self, selfType, methodName, arg1, arg2, block); } return cacheAndCall(caller, selfType, block, context, self, arg1, arg2);
RubyClass selfType = pollAndGetClass(context, self); CacheEntry myCache = cache; if (myCache.typeOk(selfType)) { return myCache.method.call(context, self, selfType, methodName, arg1, arg2, arg3); } return cacheAndCall(caller, selfType, context, self, arg1, arg2, arg3);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/runtime/callsite/CachingCallSite.java File path: /jruby-1.4.0/src/org/jruby/runtime/callsite/CachingCallSite.java
Method name: IRubyObject callBlock(ThreadContext, IRubyObject, IRubyObject, IRubyObject, IRubyObject, Block) Method name: IRubyObject call(ThreadContext, IRubyObject, IRubyObject, IRubyObject, IRubyObject, IRubyObject)
Number of AST nodes: 5 Number of AST nodes: 5
1
RubyClass selfType = pollAndGetClass(context, self);
1
RubyClass selfType = pollAndGetClass(context, self);
2
        CacheEntry myCache = cache;
2
        CacheEntry myCache = cache;
3
        if (myCache.typeOk(selfType)) {
3
        if (myCache.typeOk(selfType)) {
4
            return myCache.method.call(context, self, selfType, methodName, arg1, arg2, block);
4
            return myCache.method.call(context, self, selfType, methodName, arg1, arg2, arg3);
5
        }
5
        }
6
        return cacheAndCall(caller, selfType, block, context, self, arg1, arg2);
6
        return cacheAndCall(caller, selfType, context, self, arg1, arg2, arg3);
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RubyClass selfType = pollAndGetClass(context, self);
    1
    RubyClass selfType = pollAndGetClass(context, self);
    2
    CacheEntry myCache = cache;
    2
    CacheEntry myCache = cache;
    3
    if (myCache.typeOk(selfType))
    3
    if (myCache.typeOk(selfType))
    4
    return myCache.method.call(context, self, selfType, methodName, arg1, arg2, block);
    4
    return myCache.method.call(context, self, selfType, methodName, arg1, arg2, block);
    4
    return myCache.method.call(context, self, selfType, methodName, arg1, arg2, arg3);
    Differences
    Expression1Expression2Difference
    blockarg3VARIABLE_NAME_MISMATCH
    org.jruby.runtime.Blockorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg3
    • Make classes org.jruby.runtime.Block and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    4
    return myCache.method.call(context, self, selfType, methodName, arg1, arg2, arg3);
    5
    return cacheAndCall(caller, selfType, block, context, self, arg1, arg2);
    5
    return cacheAndCall(caller, selfType, block, context, self, arg1, arg2);
    5
    return cacheAndCall(caller, selfType, context, self, arg1, arg2, arg3);
    Differences
    Expression1Expression2Difference
    blockcontextVARIABLE_NAME_MISMATCH
    org.jruby.runtime.Blockorg.jruby.runtime.ThreadContextVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.ThreadContext of variable context
    • Make classes org.jruby.runtime.Block and org.jruby.runtime.ThreadContext extend a common superclass
    5
    return cacheAndCall(caller, selfType, context, self, arg1, arg2, arg3);
    Precondition Violations (2)
    Row Violation
    1Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg3
    2Type org.jruby.runtime.Block of variable block does not match with type org.jruby.runtime.ThreadContext of variable context