RubyClass selfType = pollAndGetClass(context, self); CacheEntry myCache = cache; if (myCache.typeOk(selfType)) { return myCache.method.call(context, self, selfType, methodName, args); } return cacheAndCall(caller, selfType, args, context, self);
RubyClass selfType = pollAndGetClass(context, self); CacheEntry myCache = cache; if (myCache.typeOk(selfType)) { return myCache.method.call(context, self, selfType, methodName, arg1); } return cacheAndCall(caller, selfType, context, self, arg1);
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 call(ThreadContext, IRubyObject, IRubyObject, IRubyObject[]) Method name: IRubyObject call(ThreadContext, 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, args);
4
            return myCache.method.call(context, self, selfType, methodName, arg1);
5
        }
5
        }
6
        return cacheAndCall(caller, selfType, args, context, self);
6
        return cacheAndCall(caller, selfType, context, self, arg1);
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)7.5
    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, args);
    4
    return myCache.method.call(context, self, selfType, methodName, args);
    4
    return myCache.method.call(context, self, selfType, methodName, arg1);
    Differences
    Expression1Expression2Difference
    argsarg1VARIABLE_NAME_MISMATCH
    org.jruby.runtime.builtin.IRubyObject[]org.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.builtin.IRubyObject[] of variable args does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg1
    • Make classes org.jruby.runtime.builtin.IRubyObject[] and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    4
    return myCache.method.call(context, self, selfType, methodName, arg1);
    5
    return cacheAndCall(caller, selfType, args, context, self);
    5
    return cacheAndCall(caller, selfType, args, context, self);
    5
    return cacheAndCall(caller, selfType, context, self, arg1);
    Differences
    Expression1Expression2Difference
    argscontextVARIABLE_NAME_MISMATCH
    org.jruby.runtime.builtin.IRubyObject[]org.jruby.runtime.ThreadContextVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.builtin.IRubyObject[] of variable args does not match with type org.jruby.runtime.ThreadContext of variable context
    • Make classes org.jruby.runtime.builtin.IRubyObject[] and org.jruby.runtime.ThreadContext extend a common superclass
    5
    return cacheAndCall(caller, selfType, context, self, arg1);
    Precondition Violations (2)
    Row Violation
    1Type org.jruby.runtime.builtin.IRubyObject[] of variable args does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg1
    2Type org.jruby.runtime.builtin.IRubyObject[] of variable args does not match with type org.jruby.runtime.ThreadContext of variable context