RubyClass result = module.defineClassUnder(CLASS_NAME, module.fastGetClass("Pointer"), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); result.defineAnnotatedMethods(AbstractInvoker.class); result.defineAnnotatedConstants(AbstractInvoker.class); return result;
RubyClass result = module.defineClassUnder(AUTOPTR_CLASS_NAME, module.getClass("Pointer"), AutoPointerAllocator.INSTANCE); result.defineAnnotatedMethods(AutoPointer.class); result.defineAnnotatedConstants(AutoPointer.class); return result;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ext/ffi/AbstractInvoker.java File path: /jruby-1.4.0/src/org/jruby/ext/ffi/AutoPointer.java
Method name: RubyClass createAbstractInvokerClass(Ruby, RubyModule) Method name: RubyClass createAutoPointerClass(Ruby, RubyModule)
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyClass result = module.defineClassUnder(CLASS_NAME,
1
RubyClass result = module.defineClassUnder(AUTOPTR_CLASS_NAME,
2
                module.fastGetClass("Pointer"),
2
                module.getClass("Pointer"),
3
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
3
                AutoPointerAllocator.INSTANCE);
4
        result.defineAnnotatedMethods(AbstractInvoker.class);
4
        result.defineAnnotatedMethods(AutoPointer.class);
5
        result.defineAnnotatedConstants(AbstractInvoker.class);
5
        result.defineAnnotatedConstants(AutoPointer.class);
6
        return result;
6
        return result;
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RubyClass result = module.defineClassUnder(CLASS_NAME, module.fastGetClass("Pointer"), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    1
    RubyClass result = module.defineClassUnder(CLASS_NAME, module.fastGetClass("Pointer"), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    1
    RubyClass result = module.defineClassUnder(AUTOPTR_CLASS_NAME, module.getClass("Pointer"), AutoPointerAllocator.INSTANCE);
    Differences
    Expression1Expression2Difference
    CLASS_NAMEAUTOPTR_CLASS_NAMEVARIABLE_NAME_MISMATCH
    fastGetClassgetClassMETHOD_INVOCATION_NAME_MISMATCH
    org.jruby.runtime.ObjectAllocatororg.jruby.ext.ffi.AutoPointer.AutoPointerAllocatorVARIABLE_TYPE_MISMATCH
    NOT_ALLOCATABLE_ALLOCATORINSTANCEVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.ObjectAllocator of variable ObjectAllocator does not match with type org.jruby.ext.ffi.AutoPointer.AutoPointerAllocator of variable AutoPointerAllocator
    • Make classes org.jruby.runtime.ObjectAllocator and org.jruby.ext.ffi.AutoPointer.AutoPointerAllocator extend a common superclass
    1
    RubyClass result = module.defineClassUnder(AUTOPTR_CLASS_NAME, module.getClass("Pointer"), AutoPointerAllocator.INSTANCE);
    2
    result.defineAnnotatedMethods(AbstractInvoker.class);
    2
    result.defineAnnotatedMethods(AutoPointer.class);
    3
    result.defineAnnotatedConstants(AbstractInvoker.class);
    3
    result.defineAnnotatedConstants(AutoPointer.class);
    4
    return result;
    4
    return result;
    Precondition Violations (1)
    Row Violation
    1Type org.jruby.runtime.ObjectAllocator of variable ObjectAllocator does not match with type org.jruby.ext.ffi.AutoPointer.AutoPointerAllocator of variable AutoPointerAllocator