RubyClass methodClass = runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setMethod(methodClass); methodClass.defineAnnotatedMethods(RubyMethod.class); return methodClass;
RubyClass newClass = runtime.defineClass("UnboundMethod", runtime.getMethod(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setUnboundMethod(newClass); newClass.defineAnnotatedMethods(RubyUnboundMethod.class); return newClass;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyMethod.java File path: /jruby-1.4.0/src/org/jruby/RubyUnboundMethod.java
Method name: RubyClass createMethodClass(Ruby) Method name: RubyClass defineUnboundMethodClass(Ruby)
Number of AST nodes: 4 Number of AST nodes: 4
1
RubyClass methodClass = 
1
RubyClass newClass = 
2
runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
2
        	runtime.defineClass("UnboundMethod", runtime.getMethod(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
3
        runtime.setMethod(methodClass);
3
        runtime.setUnboundMethod(newClass);
4
        
5
        methodClass.defineAnnotatedMethods(RubyMethod.class);
4
        newClass.defineAnnotatedMethods(RubyUnboundMethod.class);
6
        
7
        return methodClass;
5
        return newClass;
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 comparisons16
  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 methodClass = runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    1
    RubyClass methodClass = runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    1
    RubyClass newClass = runtime.defineClass("UnboundMethod", runtime.getMethod(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    Differences
    Expression1Expression2Difference
    methodClassnewClassVARIABLE_NAME_MISMATCH
    "Method""UnboundMethod"LITERAL_VALUE_MISMATCH
    getObjectgetMethodMETHOD_INVOCATION_NAME_MISMATCH
    1
    RubyClass newClass = runtime.defineClass("UnboundMethod", runtime.getMethod(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    2
    runtime.setMethod(methodClass);
    2
    runtime.setMethod(methodClass);
    2
    runtime.setUnboundMethod(newClass);
    Differences
    Expression1Expression2Difference
    setMethodsetUnboundMethodMETHOD_INVOCATION_NAME_MISMATCH
    methodClassnewClassVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression runtime.setMethod(methodClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression runtime.setUnboundMethod(newClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression runtime.setMethod(methodClass) is a void method call, and thus it cannot be parameterized
    Expression runtime.setUnboundMethod(newClass) is a void method call, and thus it cannot be parameterized
    2
    runtime.setUnboundMethod(newClass);
    3
    methodClass.defineAnnotatedMethods(RubyMethod.class);
    3
    methodClass.defineAnnotatedMethods(RubyMethod.class);
    3
    newClass.defineAnnotatedMethods(RubyUnboundMethod.class);
    Differences
    Expression1Expression2Difference
    methodClassnewClassVARIABLE_NAME_MISMATCH
    3
    newClass.defineAnnotatedMethods(RubyUnboundMethod.class);
    4
    return methodClass;
    4
    return methodClass;
    4
    return newClass;
    Differences
    Expression1Expression2Difference
    methodClassnewClassVARIABLE_NAME_MISMATCH
    4
    return newClass;
    Precondition Violations (4)
    Row Violation
    1Expression runtime.setMethod(methodClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression runtime.setUnboundMethod(newClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression runtime.setMethod(methodClass) is a void method call, and thus it cannot be parameterized
    4Expression runtime.setUnboundMethod(newClass) is a void method call, and thus it cannot be parameterized