int newSize = scopeStack.length * 2; DynamicScope[] newScopeStack = new DynamicScope[newSize]; System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length); scopeStack = newScopeStack;
int newSize = parentStack.length * 2; RubyModule[] newParentStack = new RubyModule[newSize]; System.arraycopy(parentStack, 0, newParentStack, 0, parentStack.length); parentStack = newParentStack;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/runtime/ThreadContext.java File path: /jruby-1.4.0/src/org/jruby/runtime/ThreadContext.java
Method name: void expandScopesIfNecessary() Method name: void expandParentsIfNecessary()
Number of AST nodes: 4 Number of AST nodes: 4
1
int newSize = scopeStack.length * 2;
1
int newSize = parentStack.length * 2;
2
        DynamicScope[] newScopeStack = new DynamicScope[newSize];
2
        RubyModule[] newParentStack = new RubyModule[newSize];
3
        System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length);
3
        System.arraycopy(parentStack, 0, newParentStack, 0, parentStack.length);
4
        scopeStack = newScopeStack;
4
        parentStack = newParentStack;
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 declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int newSize = scopeStack.length * 2;
    1
    int newSize = scopeStack.length * 2;
    1
    int newSize = parentStack.length * 2;
    Differences
    Expression1Expression2Difference
    scopeStackparentStackVARIABLE_NAME_MISMATCH
    org.jruby.runtime.DynamicScope[]org.jruby.RubyModule[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.DynamicScope[] of variable scopeStack does not match with type org.jruby.RubyModule[] of variable parentStack
    • Make classes org.jruby.runtime.DynamicScope[] and org.jruby.RubyModule[] extend a common superclass
    1
    int newSize = parentStack.length * 2;
                                                                                                                  
    2
    RubyModule[] newParentStack = new RubyModule[newSize];
    Preondition Violations
    Unmatched statement RubyModule[] newParentStack=new RubyModule[newSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    RubyModule[] newParentStack = new RubyModule[newSize];
    2
    DynamicScope[] newScopeStack = new DynamicScope[newSize];
    2
    DynamicScope[] newScopeStack = new DynamicScope[newSize];
    Preondition Violations
    Unmatched statement DynamicScope[] newScopeStack=new DynamicScope[newSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                        
    3
    System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length);
    3
    System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length);
    3
    System.arraycopy(parentStack, 0, newParentStack, 0, parentStack.length);
    Differences
    Expression1Expression2Difference
    scopeStackparentStackVARIABLE_NAME_MISMATCH
    org.jruby.runtime.DynamicScope[]org.jruby.RubyModule[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.DynamicScope[] of variable scopeStack does not match with type org.jruby.RubyModule[] of variable parentStack
    • Make classes org.jruby.runtime.DynamicScope[] and org.jruby.RubyModule[] extend a common superclass
    3
    System.arraycopy(parentStack, 0, newParentStack, 0, parentStack.length);
                                                                
    4
    parentStack = newParentStack;
    4
    scopeStack = newScopeStack;
                                                            
    Precondition Violations (4)
    Row Violation
    1Type org.jruby.runtime.DynamicScope[] of variable scopeStack does not match with type org.jruby.RubyModule[] of variable parentStack
    2Unmatched statement RubyModule[] newParentStack=new RubyModule[newSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement DynamicScope[] newScopeStack=new DynamicScope[newSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.jruby.runtime.DynamicScope[] of variable scopeStack does not match with type org.jruby.RubyModule[] of variable parentStack