String mname = getNewRescueName(); BaseBodyCompiler rescueMethod = outline(mname); rescueMethod.performRescueLight(regularCode, rubyCatchCode, needsRetry); rescueMethod.endBody();
String mname = getNewRescueName(); BaseBodyCompiler nested = outline(mname); nested.performBooleanLoopSafeInner(condition, body, checkFirst);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/impl/BaseBodyCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/impl/BaseBodyCompiler.java
Method name: void performRescue(BranchCallback, BranchCallback, boolean) Method name: void performBooleanLoopSafe(BranchCallback, BranchCallback, boolean)
Number of AST nodes: 4 Number of AST nodes: 3
1
String mname = getNewRescueName();
1
String mname = getNewRescueName();
2
        BaseBodyCompiler rescueMethod = outline(mname);
2
        BaseBodyCompiler nested = outline(mname);
3
        rescueMethod.performRescueLight(regularCode, rubyCatchCode, needsRetry);
3
        nested.performBooleanLoopSafeInner(condition, body, 
4
        rescueMethod.endBody();
4
checkFirst);
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 comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    String mname = getNewRescueName();
    1
    String mname = getNewRescueName();
    2
    BaseBodyCompiler rescueMethod = outline(mname);
    2
    BaseBodyCompiler rescueMethod = outline(mname);
    2
    BaseBodyCompiler nested = outline(mname);
    Differences
    Expression1Expression2Difference
    rescueMethodnestedVARIABLE_NAME_MISMATCH
    2
    BaseBodyCompiler nested = outline(mname);
    3
    rescueMethod.performRescueLight(regularCode, rubyCatchCode, needsRetry);
    3
    rescueMethod.performRescueLight(regularCode, rubyCatchCode, needsRetry);
    Preondition Violations
    Unmatched statement rescueMethod.performRescueLight(regularCode,rubyCatchCode,needsRetry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                      
    4
    rescueMethod.endBody();
    4
    rescueMethod.endBody();
    3
    nested.performBooleanLoopSafeInner(condition, body, checkFirst);
    Differences
    Expression1Expression2Difference
    endBodyperformBooleanLoopSafeInnerMETHOD_INVOCATION_NAME_MISMATCH
    rescueMethodnestedVARIABLE_NAME_MISMATCH
    rescueMethod.endBody()nested.performBooleanLoopSafeInner(condition,body,checkFirst)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression rescueMethod.endBody() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method performBooleanLoopSafeInner
    Expression rescueMethod.endBody() is a void method call, and thus it cannot be parameterized
    Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) is a void method call, and thus it cannot be parameterized
    Expression rescueMethod.endBody() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method performBooleanLoopSafeInner
    Expression rescueMethod.endBody() is a void method call, and thus it cannot be parameterized
    Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) is a void method call, and thus it cannot be parameterized
    3
    nested.performBooleanLoopSafeInner(condition, body, checkFirst);
    Precondition Violations (10)
    Row Violation
    1Unmatched statement rescueMethod.performRescueLight(regularCode,rubyCatchCode,needsRetry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression rescueMethod.endBody() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression rescueMethod.endBody() is a void method call, and thus it cannot be parameterized
    5Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) is a void method call, and thus it cannot be parameterized
    6Expression rescueMethod.endBody() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression rescueMethod.endBody() is a void method call, and thus it cannot be parameterized
    9Expression nested.performBooleanLoopSafeInner(condition,body,checkFirst) is a void method call, and thus it cannot be parameterized
    10Clone fragment #1 returns variables rescueMethod , while Clone fragment #2 returns variables