if (computeMaxs) { // updates current stack size (max stack size unchanged) --stackSize; // ends current block (with many new successors) if (currentBlock != null) { currentBlock.maxStackSize = maxStackSize; addSuccessor(stackSize, dflt); for (int i = 0; i < labels.length; ++i) { addSuccessor(stackSize, labels[i]); } currentBlock = null; } } // adds the instruction to the bytecode of the method int source = code.length; code.put1(Constants.TABLESWITCH); while (code.length % 4 != 0) { code.put1(0); } dflt.put(this, code, source, true); code.put4(min).put4(max); for (int i = 0; i < labels.length; ++i) { labels[i].put(this, code, source, true); }
if (computeMaxs) { // updates current stack size (max stack size unchanged) --stackSize; // ends current block (with many new successors) if (currentBlock != null) { currentBlock.maxStackSize = maxStackSize; addSuccessor(stackSize, dflt); for (int i = 0; i < labels.length; ++i) { addSuccessor(stackSize, labels[i]); } currentBlock = null; } } // adds the instruction to the bytecode of the method int source = code.length; code.put1(Constants.LOOKUPSWITCH); while (code.length % 4 != 0) { code.put1(0); } dflt.put(this, code, source, true); code.put4(labels.length); for (int i = 0; i < labels.length; ++i) { code.put4(keys[i]); labels[i].put(this, code, source, true); }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/objectweb/asm/CodeWriter.java File path: /jEdit-4.2/src/org/objectweb/asm/CodeWriter.java
Method name: void visitTableSwitchInsn(int, int, Label, Label[]) Method name: void visitLookupSwitchInsn(Label, int[], Label[])
Number of AST nodes: 16 Number of AST nodes: 17
1
if (computeMaxs) {
1
if (computeMaxs) {
2
      // updates current stack size (max stack size unchanged)
2
      // updates current stack size (max stack size unchanged)
3
      --stackSize;
3
      --stackSize;
4
      // ends current block (with many new successors)
4
      // ends current block (with many new successors)
5
      if (currentBlock != null) {
5
      if (currentBlock != null) {
6
        currentBlock.maxStackSize = maxStackSize;
6
        currentBlock.maxStackSize = maxStackSize;
7
        addSuccessor(stackSize, dflt);
7
        addSuccessor(stackSize, dflt);
8
        for (int i = 0; i < labels.length; ++i) {
8
        for (int i = 0; i < labels.length; ++i) {
9
          addSuccessor(stackSize, labels[i]);
9
          addSuccessor(stackSize, labels[i]);
10
        }
10
        }
11
        currentBlock = null;
11
        currentBlock = null;
12
      }
12
      }
13
    }
13
    }
14
    // adds the instruction to the bytecode of the method
14
    // adds the instruction to the bytecode of the method
15
    int source = code.length;
15
    int source = code.length;
16
    code.put1(Constants.TABLESWITCH);
16
    code.put1(Constants.LOOKUPSWITCH);
17
    while (code.length % 4 != 0) {
17
    while (code.length % 4 != 0) {
18
      code.put1(0);
18
      code.put1(0);
19
    }
19
    }
20
    dflt.put(this, code, source, true);
20
    dflt.put(this, code, source, true);
21
    code.put4(min).put4(max);
21
    code.put4(labels.length);
22
    for (int i = 0; i < labels.length; ++i) {
22
    for (int i = 0; i < labels.length; ++i) {
23
      code.put4(keys[i]);
23
      labels[i].put(this, code, source, true);
24
      labels[i].put(this, code, source, true);
24
    }
25
    }
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.7
Clones locationClones are declared in the same class
Number of node comparisons57
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)6.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (computeMaxs)
    1
    if (computeMaxs)
    2
    --stackSize;
    2
    --stackSize;
    3
    if (currentBlock != null)
    3
    if (currentBlock != null)
    4
    currentBlock.maxStackSize = maxStackSize;
    4
    currentBlock.maxStackSize = maxStackSize;
    5
    addSuccessor(stackSize, dflt);
    5
    addSuccessor(stackSize, dflt);
    6
    for (int i = 0; i < labels.length; ++i)
    6
    for (int i = 0; i < labels.length; ++i)
    7
    addSuccessor(stackSize, labels[i]);
    7
    addSuccessor(stackSize, labels[i]);
    8
    currentBlock = null;
    8
    currentBlock = null;
    9
    int source = code.length;
    9
    int source = code.length;
    10
    code.put1(Constants.TABLESWITCH);
    10
    code.put1(Constants.TABLESWITCH);
    10
    code.put1(Constants.LOOKUPSWITCH);
    Differences
    Expression1Expression2Difference
    TABLESWITCHLOOKUPSWITCHVARIABLE_NAME_MISMATCH
    10
    code.put1(Constants.LOOKUPSWITCH);
    11
    while (code.length % 4 != 0)
    11
    while (code.length % 4 != 0)
    12
    code.put1(0);
    12
    code.put1(0);
    13
    dflt.put(this, code, source, true);
    13
    dflt.put(this, code, source, true);
    14
    code.put4(min).put4(max);
    14
    code.put4(min).put4(max);
    14
    code.put4(labels.length);
    Differences
    Expression1Expression2Difference
    maxlabels.lengthTYPE_COMPATIBLE_REPLACEMENT
    code.put4(min)codeTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression code.put4(min) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    code.put4(labels.length);
    15
    for (int i = 0; i < labels.length; ++i)
    15
    for (int i = 0; i < labels.length; ++i)
                                                  
    16
    code.put4(keys[i]);
    Preondition Violations
    Unmatched statement code.put4(keys[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    code.put4(keys[i]);
    16
    labels[i].put(this, code, source, true);
    17
    labels[i].put(this, code, source, true);
    Precondition Violations (3)
    Row Violation
    1Expression code.put4(min) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement code.put4(keys[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables , while Clone fragment #2 returns variables i