assert !clone.isFrozen() : "frozen object (" + clone.getMetaClass().getName() + ") allocated"; original.copySpecialInstanceVariables(clone); if (original.hasVariables()) clone.syncVariables(original.getVariableList()); if (original instanceof RubyModule) ((RubyModule) clone).syncConstants((RubyModule) original); /* FIXME: finalizer should be dupped here */ clone.callMethod(clone.getRuntime().getCurrentContext(), "initialize_copy", original);
assert !clone.isFrozen() : "frozen object (" + clone.getMetaClass().getName() + ") allocated"; original.copySpecialInstanceVariables(clone); if (original.hasVariables()) clone.syncVariables(original.getVariableList()); if (original instanceof RubyModule) ((RubyModule) clone).syncConstants((RubyModule) original); /* FIXME: finalizer should be dupped here */ clone.callMethod(clone.getRuntime().getCurrentContext(), "initialize_copy", original);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyObject.java File path: /jruby-1.4.0/src/org/jruby/RubyBasicObject.java
Method name: void initCopy(IRubyObject, RubyObject) Method name: void initCopy(IRubyObject, IRubyObject)
Number of AST nodes: 7 Number of AST nodes: 7
1
assert !clone.isFrozen() : "frozen object (" + clone.getMetaClass().getName() + ") allocated";
1
assert !clone.isFrozen() : "frozen object (" + clone.getMetaClass().getName() + ") allocated";
2
        original.copySpecialInstanceVariables(clone);
2
        original.copySpecialInstanceVariables(clone);
3
        if (original.hasVariables()) clone.syncVariables(original.getVariableList());
3
        if (original.hasVariables()) clone.syncVariables(original.getVariableList());
4
        if (original instanceof RubyModule) ((RubyModule) clone).syncConstants((RubyModule) original);
4
        if (original instanceof RubyModule) ((RubyModule) clone).syncConstants((RubyModule) original);
5
        /* FIXME: finalizer should be dupped here */
5
        /* FIXME: finalizer should be dupped here */
6
        clone.callMethod(clone.getRuntime().getCurrentContext(), "initialize_copy", original);
6
        clone.callMethod(clone.getRuntime().getCurrentContext(), "initialize_copy", original);
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 in different classes having the same super class
Number of node comparisons11
  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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    assert !clone.isFrozen() : "frozen object (" + clone.getMetaClass().getName() + ") allocated";
    1
    assert !clone.isFrozen() : "frozen object (" + clone.getMetaClass().getName() + ") allocated";
    2
    original.copySpecialInstanceVariables(clone);
    2
    original.copySpecialInstanceVariables(clone);
    2
    original.copySpecialInstanceVariables(clone);
    Differences
    Expression1Expression2Difference
    org.jruby.RubyObjectorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original
    • Make classes org.jruby.RubyObject and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    2
    original.copySpecialInstanceVariables(clone);
    3
    if (original.hasVariables())
    3
    if (original.hasVariables())
    3
    if (original.hasVariables())
    Differences
    Expression1Expression2Difference
    org.jruby.RubyObjectorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original
    • Make classes org.jruby.RubyObject and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    3
    if (original.hasVariables())
    4
    clone.syncVariables(original.getVariableList());
    4
    clone.syncVariables(original.getVariableList());
    4
    clone.syncVariables(original.getVariableList());
    Differences
    Expression1Expression2Difference
    org.jruby.RubyObjectorg.jruby.runtime.builtin.IRubyObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original
    • Make classes org.jruby.RubyObject and org.jruby.runtime.builtin.IRubyObject extend a common superclass
    4
    clone.syncVariables(original.getVariableList());
    Precondition Violations (3)
    Row Violation
    1Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original
    2Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original
    3Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original