final BinaryOperatorNode andNode = (BinaryOperatorNode) node; compile(andNode.getFirstNode(), context,true); BranchCallback longCallback = new BranchCallback() { public void branch(BodyCompiler context) { compile(andNode.getSecondNode(), context,true); } }; context.performLogicalAnd(longCallback); context.pollThreadEvents(); // TODO: don't require pop if (!expr) context.consumeCurrentValue();
final Match2Node matchNode = (Match2Node) node; compile(matchNode.getReceiverNode(), context,true); CompilerCallback value = new CompilerCallback() { public void call(BodyCompiler context) { compile(matchNode.getValueNode(), context,true); } }; context.match2(value); // TODO: don't require pop if (!expr) context.consumeCurrentValue();
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java
Method name: void compileOpAsgnAnd(Node, BodyCompiler, boolean) Method name: void compileMatch2(Node, BodyCompiler, boolean)
Number of AST nodes: 7 Number of AST nodes: 6
1
final BinaryOperatorNode andNode = (BinaryOperatorNode) node;
1
final Match2Node matchNode = (Match2Node) node;
2
        compile(andNode.getFirstNode(), context,true);
2
        compile(matchNode.getReceiverNode(), context,true);
3
        BranchCallback longCallback = new BranchCallback() {
3
        CompilerCallback value = new CompilerCallback() {
4
                    public void branch(BodyCompiler context) {
4
            public void call(BodyCompiler context) {
5
                        compile(andNode.getSecondNode(), context,true);
5
                compile(matchNode.getValueNode(), context,true);
6
                    }
6
            
7
        
7
}
8
        };
8
        };
9
        context.performLogicalAnd(longCallback);
9
        context.
10
        context.pollThreadEvents();
10
match2(value);
11
        // TODO: don't require pop
11
        // TODO: don't require pop
12
        if (!expr) context.consumeCurrentValue();
12
        if (!expr) context.consumeCurrentValue();
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.1
Clones locationClones are declared in the same class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                  
    1
    final Match2Node matchNode = (Match2Node)node;
    1
    final BinaryOperatorNode andNode = (BinaryOperatorNode)node;
                                                                                                                              
    2
    compile(andNode.getFirstNode(), context, true);
                                                                                                    
    3
    BranchCallback longCallback = new BranchCallback() {...};
                                                                                                                                                                                                                                                                                                                              
    4
    context.performLogicalAnd(longCallback);
    4
    context.performLogicalAnd(longCallback);
    2
    compile(matchNode.getReceiverNode(), context, true);
    Differences
    Expression1Expression2Difference
    performLogicalAndcompileMETHOD_INVOCATION_NAME_MISMATCH
    context.performLogicalAnd(longCallback)compile(matchNode.getReceiverNode(),context,true)ARGUMENT_NUMBER_MISMATCH
    contextMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression context.performLogicalAnd(longCallback) is a void method call, and thus it cannot be parameterized
    Expression compile(matchNode.getReceiverNode(),context,true) is a void method call, and thus it cannot be parameterized
    Expression context.performLogicalAnd(longCallback) is a void method call, and thus it cannot be parameterized
    Expression compile(matchNode.getReceiverNode(),context,true) is a void method call, and thus it cannot be parameterized
    2
    compile(matchNode.getReceiverNode(), context, true);
                                                                                                                                                                                                                                                                                                                      
    3
    CompilerCallback value = new CompilerCallback() {...};
    Preondition Violations
    Unmatched statement CompilerCallback value=new CompilerCallback(){ public void call( BodyCompiler context){ compile(matchNode.getValueNode(),context,true); } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    CompilerCallback value = new CompilerCallback() {...};
    5
    context.pollThreadEvents();
    5
    context.pollThreadEvents();
    4
    context.match2(value);
    Differences
    Expression1Expression2Difference
    pollThreadEventsmatch2METHOD_INVOCATION_NAME_MISMATCH
    context.pollThreadEvents()context.match2(value)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression context.match2(value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.pollThreadEvents() is a void method call, and thus it cannot be parameterized
    Expression context.match2(value) is a void method call, and thus it cannot be parameterized
    Expression context.match2(value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.pollThreadEvents() is a void method call, and thus it cannot be parameterized
    Expression context.match2(value) is a void method call, and thus it cannot be parameterized
    4
    context.match2(value);
    6
    if (!expr)
    5
    if (!expr)
    7
    context.consumeCurrentValue();
    6
    context.consumeCurrentValue();
    Precondition Violations (11)
    Row Violation
    1Expression context.performLogicalAnd(longCallback) is a void method call, and thus it cannot be parameterized
    2Expression compile(matchNode.getReceiverNode(),context,true) is a void method call, and thus it cannot be parameterized
    3Expression context.performLogicalAnd(longCallback) is a void method call, and thus it cannot be parameterized
    4Expression compile(matchNode.getReceiverNode(),context,true) is a void method call, and thus it cannot be parameterized
    5Unmatched statement CompilerCallback value=new CompilerCallback(){ public void call( BodyCompiler context){ compile(matchNode.getValueNode(),context,true); } } ; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Expression context.match2(value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression context.pollThreadEvents() is a void method call, and thus it cannot be parameterized
    8Expression context.match2(value) is a void method call, and thus it cannot be parameterized
    9Expression context.match2(value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression context.pollThreadEvents() is a void method call, and thus it cannot be parameterized
    11Expression context.match2(value) is a void method call, and thus it cannot be parameterized