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);
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 11 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.9 |
Clone type | Type 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); |
3 | if (original.hasVariables()) | | 3 | if (original.hasVariables()) |
4 | clone.syncVariables(original.getVariableList()); | | 4 | clone.syncVariables(original.getVariableList()); |
Precondition Violations (3)
Row |
Violation |
1 | Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original |
2 | Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original |
3 | Type org.jruby.RubyObject of variable original does not match with type org.jruby.runtime.builtin.IRubyObject of variable original |