int newSize = catchStack.length * 2; CatchTarget[] newCatchStack = new CatchTarget[newSize]; System.arraycopy(catchStack, 0, newCatchStack, 0, catchStack.length); catchStack = newCatchStack;
int newSize = scopeStack.length * 2; DynamicScope[] newScopeStack = new DynamicScope[newSize]; System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length); scopeStack = newScopeStack;
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 expandCatchIfNecessary() Method name: void expandScopesIfNecessary()
Number of AST nodes: 4 Number of AST nodes: 4
1
int newSize = catchStack.length * 2;
1
int newSize = scopeStack.length * 2;
2
        CatchTarget[] newCatchStack = new CatchTarget[newSize];
2
        DynamicScope[] newScopeStack = new DynamicScope[newSize];
3
        System.arraycopy(catchStack, 0, newCatchStack, 0, catchStack.length);
3
        System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length);
4
        catchStack = newCatchStack;
4
        scopeStack = newScopeStack;
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 = catchStack.length * 2;
    1
    int newSize = catchStack.length * 2;
    1
    int newSize = scopeStack.length * 2;
    Differences
    Expression1Expression2Difference
    catchStackscopeStackVARIABLE_NAME_MISMATCH
    org.jruby.RubyKernel.CatchTarget[]org.jruby.runtime.DynamicScope[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack does not match with type org.jruby.runtime.DynamicScope[] of variable scopeStack
    • Make classes org.jruby.RubyKernel.CatchTarget[] and org.jruby.runtime.DynamicScope[] extend a common superclass
    1
    int newSize = scopeStack.length * 2;
                                                                                                                        
    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
    2
    DynamicScope[] newScopeStack = new DynamicScope[newSize];
    2
    CatchTarget[] newCatchStack = new CatchTarget[newSize];
    2
    CatchTarget[] newCatchStack = new CatchTarget[newSize];
    Preondition Violations
    Unmatched statement CatchTarget[] newCatchStack=new CatchTarget[newSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                    
    3
    System.arraycopy(catchStack, 0, newCatchStack, 0, catchStack.length);
    3
    System.arraycopy(catchStack, 0, newCatchStack, 0, catchStack.length);
    3
    System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length);
    Differences
    Expression1Expression2Difference
    catchStackscopeStackVARIABLE_NAME_MISMATCH
    org.jruby.RubyKernel.CatchTarget[]org.jruby.runtime.DynamicScope[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack does not match with type org.jruby.runtime.DynamicScope[] of variable scopeStack
    • Make classes org.jruby.RubyKernel.CatchTarget[] and org.jruby.runtime.DynamicScope[] extend a common superclass
    3
    System.arraycopy(scopeStack, 0, newScopeStack, 0, scopeStack.length);
                                                            
    4
    scopeStack = newScopeStack;
    4
    catchStack = newCatchStack;
                                                            
    Precondition Violations (4)
    Row Violation
    1Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack does not match with type org.jruby.runtime.DynamicScope[] of variable scopeStack
    2Unmatched 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
    3Unmatched statement CatchTarget[] newCatchStack=new CatchTarget[newSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack does not match with type org.jruby.runtime.DynamicScope[] of variable scopeStack