final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node; CompilerCallback receiverCallback = new CompilerCallback() { public void call(BodyCompiler context) { compile(opElementAsgnNode.getReceiverNode(), context, true); } }; ArgumentsCallback argsCallback = new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode()); CompilerCallback valueCallback = new CompilerCallback() { public void call(BodyCompiler context) { compile(opElementAsgnNode.getValueNode(), context, true); } }; context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback, argsCallback, valueCallback); // TODO: don't require pop if (!expr) context.consumeCurrentValue();
final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node; CompilerCallback receiverCallback = new CompilerCallback() { public void call(BodyCompiler context) { compile(opElementAsgnNode.getReceiverNode(), context,true); } }; ArgumentsCallback argsCallback = getArgsCallback(opElementAsgnNode.getArgsNode()); CompilerCallback valueCallback = new CompilerCallback() { public void call(BodyCompiler context) { compile(opElementAsgnNode.getValueNode(), context,true); } }; context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback, argsCallback, valueCallback, opElementAsgnNode.getOperatorName()); // 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 compileOpElementAsgnWithAnd(Node, BodyCompiler, boolean) Method name: void compileOpElementAsgnWithMethod(Node, BodyCompiler, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node;
1
final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node;
2
        CompilerCallback receiverCallback = new CompilerCallback() {
2
        CompilerCallback receiverCallback = new CompilerCallback() {
3
            public void call(BodyCompiler context) {
3
            public void call(BodyCompiler context) {
4
                compile(opElementAsgnNode.getReceiverNode(), context, true);
4
                compile(opElementAsgnNode.getReceiverNode(), context,true);
5
            }
5
            }
6
        };
6
        };
7
        ArgumentsCallback argsCallback = new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode()); 
7
        ArgumentsCallback argsCallback = getArgsCallback(opElementAsgnNode.getArgsNode());
8
        CompilerCallback valueCallback = new CompilerCallback() {
8
        CompilerCallback valueCallback = new CompilerCallback() {
9
            public void call(BodyCompiler context) {
9
            public void call(BodyCompiler context) {
10
                compile(opElementAsgnNode.getValueNode(), context, true);
10
                compile(opElementAsgnNode.getValueNode(), context,true);
11
            }
11
            }
12
        };
12
        };
13
        context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback, argsCallback, valueCallback);
13
        context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback, argsCallback, valueCallback, opElementAsgnNode.getOperatorName());
14
        // TODO: don't require pop
14
        // TODO: don't require pop
15
        if (!expr) context.consumeCurrentValue();
15
        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 comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)7.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode)node;
    1
    final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode)node;
    2
    CompilerCallback receiverCallback = new CompilerCallback() {...};
    2
    CompilerCallback receiverCallback = new CompilerCallback() {...};
                                                                                                                                                                          
    3
    ArgumentsCallback argsCallback = getArgsCallback(opElementAsgnNode.getArgsNode());
    Preondition Violations
    Unmatched statement ArgumentsCallback argsCallback=getArgsCallback(opElementAsgnNode.getArgsNode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    ArgumentsCallback argsCallback = getArgsCallback(opElementAsgnNode.getArgsNode());
    3
    ArgumentsCallback argsCallback = new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode());
    3
    ArgumentsCallback argsCallback = new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode());
    Preondition Violations
    Unmatched statement ArgumentsCallback argsCallback=new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                
    4
    CompilerCallback valueCallback = new CompilerCallback() {...};
    4
    CompilerCallback valueCallback = new CompilerCallback() {...};
    5
    context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback, argsCallback, valueCallback);
    5
    context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback, argsCallback, valueCallback);
    5
    context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback, argsCallback, valueCallback, opElementAsgnNode.getOperatorName());
    Differences
    Expression1Expression2Difference
    opElementAsgnWithAndopElementAsgnWithMethodMETHOD_INVOCATION_NAME_MISMATCH
    context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback)context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) is a void method call, and thus it cannot be parameterized
    Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) is a void method call, and thus it cannot be parameterized
    Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) is a void method call, and thus it cannot be parameterized
    Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) is a void method call, and thus it cannot be parameterized
    5
    context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback, argsCallback, valueCallback, opElementAsgnNode.getOperatorName());
    6
    if (!expr)
    6
    if (!expr)
    7
    context.consumeCurrentValue();
    7
    context.consumeCurrentValue();
    Precondition Violations (10)
    Row Violation
    1Unmatched statement ArgumentsCallback argsCallback=getArgsCallback(opElementAsgnNode.getArgsNode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement ArgumentsCallback argsCallback=new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) is a void method call, and thus it cannot be parameterized
    6Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) is a void method call, and thus it cannot be parameterized
    7Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression context.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback,argsCallback,valueCallback) is a void method call, and thus it cannot be parameterized
    10Expression context.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback,argsCallback,valueCallback,opElementAsgnNode.getOperatorName()) is a void method call, and thus it cannot be parameterized