++freeEscapeIndex; if (escapes.length == freeEscapeIndex) { currentSize += SIZE; Escape newarray[] = new Escape [currentSize]; System.arraycopy(escapes, 0, newarray, 0, escapes.length); escapes = newarray; } escapes[freeEscapeIndex] = escape;
++freePrinterIndex; if (printers.length == freePrinterIndex) { currentSize += SIZE; XMLString newarray[] = new XMLString [currentSize]; System.arraycopy(printers, 0, newarray, 0, printers.length); printers = newarray; } printers[freePrinterIndex] = printer;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/ConfigurationCache.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/ConfigurationCache.java
Method name: void releaseEscape(Escape) Method name: void releasePrinter(XMLString)
Number of AST nodes: 7 Number of AST nodes: 7
1
++freeEscapeIndex;
1
++freePrinterIndex;
2
    if (escapes.length == freeEscapeIndex)
2
    if (printers.length == freePrinterIndex)
3
    {
3
    {
4
      currentSize += SIZE;
4
      currentSize += SIZE;
5
      Escape newarray[] = new Escape [currentSize];
5
      XMLString newarray[] = new XMLString [currentSize];
6
      System.arraycopy(escapes, 0, newarray, 0, escapes.length);
6
      System.arraycopy(printers, 0, newarray, 0, printers.length);
7
      escapes = newarray;
7
      printers = newarray;
8
    }
8
    }
9
    escapes[freeEscapeIndex] = escape;
9
    printers[freePrinterIndex] = printer;
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 comparisons28
  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 fragment3
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    ++freeEscapeIndex;
    1
    ++freeEscapeIndex;
    1
    ++freePrinterIndex;
    Differences
    Expression1Expression2Difference
    freeEscapeIndexfreePrinterIndexVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression freeEscapeIndex is a field being modified, and thus it cannot be parameterized
    Expression freePrinterIndex is a field being modified, and thus it cannot be parameterized
    1
    ++freePrinterIndex;
    2
    if (escapes.length == freeEscapeIndex)
    2
    if (escapes.length == freeEscapeIndex)
    2
    if (printers.length == freePrinterIndex)
    Differences
    Expression1Expression2Difference
    escapesprintersVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[]org.eclipse.emf.ecore.xmi.impl.XMLString[]VARIABLE_TYPE_MISMATCH
    freeEscapeIndexfreePrinterIndexVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[] of variable escapes does not match with type org.eclipse.emf.ecore.xmi.impl.XMLString[] of variable printers
    • Make classes org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[] and org.eclipse.emf.ecore.xmi.impl.XMLString[] extend a common superclass
    Expression freeEscapeIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression freePrinterIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (printers.length == freePrinterIndex)
    3
    currentSize += SIZE;
    3
    currentSize += SIZE;
                                                                                                          
    4
    XMLString newarray[] = new XMLString[currentSize];
    Preondition Violations
    Unmatched statement XMLString newarray[]=new XMLString[currentSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    XMLString newarray[] = new XMLString[currentSize];
    4
    Escape newarray[] = new Escape[currentSize];
    4
    Escape newarray[] = new Escape[currentSize];
    Preondition Violations
    Unmatched statement Escape newarray[]=new Escape[currentSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    5
    System.arraycopy(escapes, 0, newarray, 0, escapes.length);
    5
    System.arraycopy(escapes, 0, newarray, 0, escapes.length);
    5
    System.arraycopy(printers, 0, newarray, 0, printers.length);
    Differences
    Expression1Expression2Difference
    escapesprintersVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[]org.eclipse.emf.ecore.xmi.impl.XMLString[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[] of variable escapes does not match with type org.eclipse.emf.ecore.xmi.impl.XMLString[] of variable printers
    • Make classes org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[] and org.eclipse.emf.ecore.xmi.impl.XMLString[] extend a common superclass
    5
    System.arraycopy(printers, 0, newarray, 0, printers.length);
                                              
    6
    printers = newarray;
    6
    escapes = newarray;
                                            
                                                                                
    7
    printers[freePrinterIndex] = printer;
    7
    escapes[freeEscapeIndex] = escape;
                                                                          
    Precondition Violations (8)
    Row Violation
    1Expression freeEscapeIndex is a field being modified, and thus it cannot be parameterized
    2Expression freePrinterIndex is a field being modified, and thus it cannot be parameterized
    3Type org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[] of variable escapes does not match with type org.eclipse.emf.ecore.xmi.impl.XMLString[] of variable printers
    4Expression freeEscapeIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression freePrinterIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement XMLString newarray[]=new XMLString[currentSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement Escape newarray[]=new Escape[currentSize]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Type org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Escape[] of variable escapes does not match with type org.eclipse.emf.ecore.xmi.impl.XMLString[] of variable printers