RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.getObject(), Allocator.INSTANCE, module); result.defineAnnotatedMethods(StructLayoutBuilder.class); result.defineAnnotatedConstants(StructLayoutBuilder.class); return result;
RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.fastGetClass("IO"), Allocator.INSTANCE, module); result.defineAnnotatedMethods(FileDescriptorIO.class); result.defineAnnotatedConstants(FileDescriptorIO.class); return result;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ext/ffi/StructLayoutBuilder.java File path: /jruby-1.4.0/src/org/jruby/ext/ffi/io/FileDescriptorIO.java
Method name: RubyClass createStructLayoutBuilderClass(Ruby, RubyModule) Method name: RubyClass createFileDescriptorIOClass(Ruby, RubyModule)
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.getObject(),
1
RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.fastGetClass("IO"),
2
                Allocator.INSTANCE, module);
2
                Allocator.INSTANCE, module);
3
        result.defineAnnotatedMethods(StructLayoutBuilder.class);
3
        result.defineAnnotatedMethods(FileDescriptorIO.class);
4
        result.defineAnnotatedConstants(StructLayoutBuilder.class);
4
        result.defineAnnotatedConstants(FileDescriptorIO.class);
5
        return result;
5
        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 = runtime.defineClassUnder(CLASS_NAME, runtime.getObject(), Allocator.INSTANCE, module);
    1
    RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.getObject(), Allocator.INSTANCE, module);
    1
    RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.fastGetClass("IO"), Allocator.INSTANCE, module);
    Differences
    Expression1Expression2Difference
    getObjectfastGetClassMETHOD_INVOCATION_NAME_MISMATCH
    runtime.getObject()runtime.fastGetClass("IO")ARGUMENT_NUMBER_MISMATCH
    org.jruby.ext.ffi.StructLayoutBuilder.Allocatororg.jruby.ext.ffi.io.FileDescriptorIO.AllocatorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.ext.ffi.StructLayoutBuilder.Allocator of variable Allocator does not match with type org.jruby.ext.ffi.io.FileDescriptorIO.Allocator of variable Allocator
    • Make classes org.jruby.ext.ffi.StructLayoutBuilder.Allocator and org.jruby.ext.ffi.io.FileDescriptorIO.Allocator extend a common superclass
    1
    RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.fastGetClass("IO"), Allocator.INSTANCE, module);
    2
    result.defineAnnotatedMethods(StructLayoutBuilder.class);
    2
    result.defineAnnotatedMethods(FileDescriptorIO.class);
    3
    result.defineAnnotatedConstants(StructLayoutBuilder.class);
    3
    result.defineAnnotatedConstants(FileDescriptorIO.class);
    4
    return result;
    4
    return result;
    Precondition Violations (1)
    Row Violation
    1Type org.jruby.ext.ffi.StructLayoutBuilder.Allocator of variable Allocator does not match with type org.jruby.ext.ffi.io.FileDescriptorIO.Allocator of variable Allocator