int newSize = catchStack.length * 2; CatchTarget[] newCatchStack = new CatchTarget[newSize]; System.arraycopy(catchStack, 0, newCatchStack, 0, catchStack.length); catchStack = newCatchStack;
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 expandCatchIfNecessary() Method name: void expandParentsIfNecessary()
Number of AST nodes: 4 Number of AST nodes: 4
1
int newSize = catchStack.length * 2;
1
int newSize = parentStack.length * 2;
2
        CatchTarget[] newCatchStack = new CatchTarget[newSize];
2
        RubyModule[] newParentStack = new RubyModule[newSize];
3
        System.arraycopy(catchStack, 0, newCatchStack, 0, catchStack.length);
3
        System.arraycopy(parentStack, 0, newParentStack, 0, parentStack.length);
4
        catchStack = newCatchStack;
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 = catchStack.length * 2;
    1
    int newSize = catchStack.length * 2;
    1
    int newSize = parentStack.length * 2;
    Differences
    Expression1Expression2Difference
    catchStackparentStackVARIABLE_NAME_MISMATCH
    org.jruby.RubyKernel.CatchTarget[]org.jruby.RubyModule[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack does not match with type org.jruby.RubyModule[] of variable parentStack
    • Make classes org.jruby.RubyKernel.CatchTarget[] 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
    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(parentStack, 0, newParentStack, 0, parentStack.length);
    Differences
    Expression1Expression2Difference
    catchStackparentStackVARIABLE_NAME_MISMATCH
    org.jruby.RubyKernel.CatchTarget[]org.jruby.RubyModule[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack does not match with type org.jruby.RubyModule[] of variable parentStack
    • Make classes org.jruby.RubyKernel.CatchTarget[] and org.jruby.RubyModule[] extend a common superclass
    3
    System.arraycopy(parentStack, 0, newParentStack, 0, parentStack.length);
                                                                
    4
    parentStack = newParentStack;
    4
    catchStack = newCatchStack;
                                                            
    Precondition Violations (4)
    Row Violation
    1Type org.jruby.RubyKernel.CatchTarget[] of variable catchStack 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 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.RubyModule[] of variable parentStack