String[] firstSplit = descriptor.split(","); String[] secondSplit; if (firstSplit[2].length() == 0) { secondSplit = new String[0]; } else { secondSplit = firstSplit[2].split(";"); // FIXME: Big fat hack here, because scope names are expected to be interned strings by the parser for (int i = 0; i < secondSplit.length; i++) { secondSplit[i] = secondSplit[i].intern(); } } BlockBody body = RuntimeHelpers.createCompiledBlockBody19( context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), Boolean.valueOf(firstSplit[5])); return blockBodies[index] = body;
String[] firstSplit = descriptor.split(","); String[] secondSplit; if (firstSplit[2].length() == 0) { secondSplit = new String[0]; } else { secondSplit = firstSplit[2].split(";"); // FIXME: Big fat hack here, because scope names are expected to be interned strings by the parser for (int i = 0; i < secondSplit.length; i++) { secondSplit[i] = secondSplit[i].intern(); } } BlockBody body = RuntimeHelpers.createCompiledBlockBody( context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), Boolean.valueOf(firstSplit[5])); return blockBodies[index] = body;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ast/executable/AbstractScript.java File path: /jruby-1.4.0/src/org/jruby/ast/executable/AbstractScript.java
Method name: BlockBody createBlockBody19(Object, ThreadContext, int, String) Method name: BlockBody createBlockBody(Object, ThreadContext, int, String)
Number of AST nodes: 9 Number of AST nodes: 9
1
String[] firstSplit = descriptor.split(",");
1
String[] firstSplit = descriptor.split(",");
2
            String[] secondSplit;
2
            String[] secondSplit;
3
            if (firstSplit[2].length() == 0) {
3
            if (firstSplit[2].length() == 0) {
4
                secondSplit = new String[0];
4
                secondSplit = new String[0];
5
            } else {
5
            } else {
6
                secondSplit = firstSplit[2].split(";");
6
                secondSplit = firstSplit[2].split(";");
7
                // FIXME: Big fat hack here, because scope names are expected to be interned strings by the parser
7
                // FIXME: Big fat hack here, because scope names are expected to be interned strings by the parser
8
                for (int i = 0; i < secondSplit.length; i++) {
8
                for (int i = 0; i < secondSplit.length; i++) {
9
                    secondSplit[i] = secondSplit[i].intern();
9
                    secondSplit[i] = secondSplit[i].intern();
10
                }
10
                }
11
            }
11
            }
12
            BlockBody body = RuntimeHelpers.createCompiledBlockBody19(
12
            BlockBody body = RuntimeHelpers.createCompiledBlockBody(
13
                    context,
13
                    context,
14
                    scriptObject,
14
                    scriptObject,
15
                    firstSplit[0],
15
                    firstSplit[0],
16
                    Integer.parseInt(firstSplit[1]),
16
                    Integer.parseInt(firstSplit[1]),
17
                    secondSplit,
17
                    secondSplit,
18
                    Boolean.valueOf(firstSplit[3]),
18
                    Boolean.valueOf(firstSplit[3]),
19
                    Integer.parseInt(firstSplit[4]),
19
                    Integer.parseInt(firstSplit[4]),
20
                    Boolean.valueOf(firstSplit[5]));
20
                    Boolean.valueOf(firstSplit[5]));
21
            return blockBodies[index] = body;
21
            return blockBodies[index] = body;
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 comparisons23
  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)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String[] firstSplit = descriptor.split(",");
    1
    String[] firstSplit = descriptor.split(",");
    2
    String[] secondSplit;
    2
    String[] secondSplit;
    3
    if (firstSplit[2].length() == 0)
    3
    if (firstSplit[2].length() == 0)
    4
    secondSplit = new String[0];
    4
    secondSplit = new String[0];
    else
    else
    5
    secondSplit = firstSplit[2].split(";");
    5
    secondSplit = firstSplit[2].split(";");
    6
    for (int i = 0; i < secondSplit.length; i++)
    6
    for (int i = 0; i < secondSplit.length; i++)
    7
    secondSplit[i] = secondSplit[i].intern();
    7
    secondSplit[i] = secondSplit[i].intern();
    8
    BlockBody body = RuntimeHelpers.createCompiledBlockBody19(context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), Boolean.valueOf(firstSplit[5]));
    8
    BlockBody body = RuntimeHelpers.createCompiledBlockBody19(context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), Boolean.valueOf(firstSplit[5]));
    8
    BlockBody body = RuntimeHelpers.createCompiledBlockBody(context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), Boolean.valueOf(firstSplit[5]));
    Differences
    Expression1Expression2Difference
    createCompiledBlockBody19createCompiledBlockBodyMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression RuntimeHelpers.createCompiledBlockBody19(context,scriptObject,firstSplit[0],Integer.parseInt(firstSplit[1]),secondSplit,Boolean.valueOf(firstSplit[3]),Integer.parseInt(firstSplit[4]),Boolean.valueOf(firstSplit[5])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression RuntimeHelpers.createCompiledBlockBody(context,scriptObject,firstSplit[0],Integer.parseInt(firstSplit[1]),secondSplit,Boolean.valueOf(firstSplit[3]),Integer.parseInt(firstSplit[4]),Boolean.valueOf(firstSplit[5])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    BlockBody body = RuntimeHelpers.createCompiledBlockBody(context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), Boolean.valueOf(firstSplit[5]));
    9
    return blockBodies[index] = body;
    9
    return blockBodies[index] = body;
    Precondition Violations (2)
    Row Violation
    1Expression RuntimeHelpers.createCompiledBlockBody19(context,scriptObject,firstSplit[0],Integer.parseInt(firstSplit[1]),secondSplit,Boolean.valueOf(firstSplit[3]),Integer.parseInt(firstSplit[4]),Boolean.valueOf(firstSplit[5])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression RuntimeHelpers.createCompiledBlockBody(context,scriptObject,firstSplit[0],Integer.parseInt(firstSplit[1]),secondSplit,Boolean.valueOf(firstSplit[3]),Integer.parseInt(firstSplit[4]),Boolean.valueOf(firstSplit[5])) cannot be parameterized, because it has dependencies to/from statements that will be extracted