if (start != 0 || end != entries.length) { Object [] actualObjects = new Object [collectionSize]; for (int i = 0, j = start; j < end; ++i, ++j) { actualObjects[i] = entries[j]; } notification = createNotification(Notification.ADD_MANY, null, actualObjects, index, oldIsSet); } else { notification = createNotification(Notification.ADD_MANY, null, entries, index, oldIsSet); }
if (start != 0 || end != objects.length) { Object [] actualObjects = new Object [collectionSize]; for (int i = 0, j = start; j < end; ++i, ++j) { actualObjects[i] = objects[j]; } notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet); } else { notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java File path: /emf-2.4.1/src/org/eclipse/emf/common/notify/impl/NotifyingListImpl.java
Method name: boolean addAllUnique(int, FeatureMap.Entry.Internal[], int, int) Method name: boolean addAllUnique(int, Object[], int, int)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (start != 0 || end != entries.length)
1
if (start != 0 || end != objects.length)
2
          {
2
          {
3
            Object [] actualObjects = new Object [collectionSize];
3
            Object [] actualObjects = new Object [collectionSize];
4
            for (int i = 0, j = start; j < end; ++i, ++j)
4
            for (int i = 0, j = start; j < end; ++i, ++j)
5
            {
5
            {
6
              actualObjects[i] = entries[j];
6
              actualObjects[i] = objects[j];
7
            }
7
            }
8
            notification = createNotification(Notification.ADD_MANY, null, actualObjects, index, oldIsSet);
8
            notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet);
9
          }
9
          }
10
          else
10
          else
11
          {
11
          {
12
            notification =  createNotification(Notification.ADD_MANY, null, entries, index, oldIsSet);
12
            notification =  createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet);
13
          }
13
          }
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 in different classes having the same super class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    if (start != 0 || end != entries.length)
    11
    if (start != 0 || end != entries.length)
    10
    if (start != 0 || end != objects.length)
    Differences
    Expression1Expression2Difference
    entriesobjectsVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] of variable entries does not match with type java.lang.Object[] of variable objects
    • Make classes org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] and java.lang.Object[] extend a common superclass
    10
    if (start != 0 || end != objects.length)
    12
    Object[] actualObjects = new Object[collectionSize];
    11
    Object[] actualObjects = new Object[collectionSize];
    13
    for (int i = 0, j = start; j < end; ++i, ++j)
    12
    for (int i = 0, j = start; j < end; ++i, ++j)
                                                                    
    13
    actualObjects[i] = objects[j];
    Preondition Violations
    Unmatched statement actualObjects[i]=objects[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    actualObjects[i] = objects[j];
    14
    actualObjects[i] = entries[j];
    14
    actualObjects[i] = entries[j];
    Preondition Violations
    Unmatched statement actualObjects[i]=entries[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
                                                                                                                                                                                                                            
    14
    notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet);
    15
    notification = createNotification(Notification.ADD_MANY, null, actualObjects, index, oldIsSet);
                                                                                                                                                                                              
    else
            
                                                                                                                                                                                                                
    15
    notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet);
    16
    notification = createNotification(Notification.ADD_MANY, null, entries, index, oldIsSet);
                                                                                                                                                                                  
    Precondition Violations (4)
    Row Violation
    1Type org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] of variable entries does not match with type java.lang.Object[] of variable objects
    2Unmatched statement actualObjects[i]=objects[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement actualObjects[i]=entries[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables actualObjects, i, j , while Clone fragment #2 returns variables actualObjects, i, j