switch (globalVarNode.getName().charAt(1)) { case '_': context.getVariableCompiler().retrieveLastLine(); break; case '~': context.getVariableCompiler().retrieveBackRef(); break; default: context.retrieveGlobalVariable(globalVarNode.getName()); }
switch (globalAsgnNode.getName().charAt(1)) { case '_': context.getVariableCompiler().assignLastLine(); break; case '~': context.getVariableCompiler().assignBackRef(); break; default: context.assignGlobalVariable(globalAsgnNode.getName()); }
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 compileGlobalVar(Node, BodyCompiler, boolean) Method name: void compileGlobalAsgnAssignment(Node, BodyCompiler, boolean)
Number of AST nodes: 9 Number of AST nodes: 9
1
switch (globalVarNode.getName().charAt(1)) {
1
switch (globalAsgnNode.getName().charAt(1)) {
2
                case '_':
2
            case '_':
3
                    context.getVariableCompiler().retrieveLastLine();
3
                context.getVariableCompiler().assignLastLine();
4
                    break;
4
                break;
5
                case '~':
5
            case '~':
6
                    context.getVariableCompiler().retrieveBackRef();
6
                context.getVariableCompiler().assignBackRef();
7
                    break;
7
                break;
8
                default:
8
            default:
9
                    context.retrieveGlobalVariable(globalVarNode.getName());
9
                context.assignGlobalVariable(globalAsgnNode.getName());
10
                }
10
            }
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.4
Clones locationClones are declared in the same class
Number of node comparisons45
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    switch (globalVarNode.getName().charAt(1))
    6
    switch (globalVarNode.getName().charAt(1))
    3
    switch (globalAsgnNode.getName().charAt(1))
    Differences
    Expression1Expression2Difference
    globalVarNodeglobalAsgnNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.GlobalVarNodeorg.jruby.ast.GlobalAsgnNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression globalVarNode cannot be unified with expression globalAsgnNode , because common superclass org.jruby.ast.Node does not declare member(s) public java.lang.String getName()
    3
    switch (globalAsgnNode.getName().charAt(1))
    7
    case '_':
    4
    case '_':
    8
    context.getVariableCompiler().retrieveLastLine();
    8
    context.getVariableCompiler().retrieveLastLine();
    5
    context.getVariableCompiler().assignLastLine();
    Differences
    Expression1Expression2Difference
    retrieveLastLineassignLastLineMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression context.getVariableCompiler().retrieveLastLine() is a void method call, and thus it cannot be parameterized
    Expression context.getVariableCompiler().assignLastLine() is a void method call, and thus it cannot be parameterized
    5
    context.getVariableCompiler().assignLastLine();
    9
    break;
    6
    break;
    10
    case '~':
    7
    case '~':
    11
    context.getVariableCompiler().retrieveBackRef();
    11
    context.getVariableCompiler().retrieveBackRef();
    8
    context.getVariableCompiler().assignBackRef();
    Differences
    Expression1Expression2Difference
    retrieveBackRefassignBackRefMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression context.getVariableCompiler().retrieveBackRef() is a void method call, and thus it cannot be parameterized
    Expression context.getVariableCompiler().assignBackRef() is a void method call, and thus it cannot be parameterized
    8
    context.getVariableCompiler().assignBackRef();
    12
    break;
    9
    break;
    13
    default:
    10
    default:
    14
    context.retrieveGlobalVariable(globalVarNode.getName());
    14
    context.retrieveGlobalVariable(globalVarNode.getName());
    11
    context.assignGlobalVariable(globalAsgnNode.getName());
    Differences
    Expression1Expression2Difference
    retrieveGlobalVariableassignGlobalVariableMETHOD_INVOCATION_NAME_MISMATCH
    globalVarNodeglobalAsgnNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.GlobalVarNodeorg.jruby.ast.GlobalAsgnNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression context.retrieveGlobalVariable(globalVarNode.getName()) is a void method call, and thus it cannot be parameterized
    Expression context.assignGlobalVariable(globalAsgnNode.getName()) is a void method call, and thus it cannot be parameterized
    Expression globalVarNode cannot be unified with expression globalAsgnNode , because common superclass org.jruby.ast.Node does not declare member(s) public java.lang.String getName()
    11
    context.assignGlobalVariable(globalAsgnNode.getName());
    Precondition Violations (8)
    Row Violation
    1Expression globalVarNode cannot be unified with expression globalAsgnNode , because common superclass org.jruby.ast.Node does not declare member(s) public java.lang.String getName()
    2Expression context.getVariableCompiler().retrieveLastLine() is a void method call, and thus it cannot be parameterized
    3Expression context.getVariableCompiler().assignLastLine() is a void method call, and thus it cannot be parameterized
    4Expression context.getVariableCompiler().retrieveBackRef() is a void method call, and thus it cannot be parameterized
    5Expression context.getVariableCompiler().assignBackRef() is a void method call, and thus it cannot be parameterized
    6Expression context.retrieveGlobalVariable(globalVarNode.getName()) is a void method call, and thus it cannot be parameterized
    7Expression context.assignGlobalVariable(globalAsgnNode.getName()) is a void method call, and thus it cannot be parameterized
    8Expression globalVarNode cannot be unified with expression globalAsgnNode , because common superclass org.jruby.ast.Node does not declare member(s) public java.lang.String getName()