if (key != null && key.eIsProxy()) { InternalEObject oldKey = (InternalEObject)key; key = (ENamedElement)eResolveProxy(oldKey); if (key != oldKey) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, Ecore2XMLPackage.ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__KEY, oldKey, key)); } } return key;
if (data != null && data.eIsProxy()) { InternalEObject oldData = (InternalEObject)data; data = eResolveProxy(oldData); if (data != oldData) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreePackage.TREE_NODE__DATA, oldData, data)); } } return data;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/impl/ENamedElementToXMLInfoMapEntryImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/tree/impl/TreeNodeImpl.java
Method name: ENamedElement getTypedKey() Method name: EObject getData()
Number of AST nodes: 7 Number of AST nodes: 7
1
if (key != null && key.eIsProxy())
1
if (data != null && data.eIsProxy())
2
    {
2
    {
3
      InternalEObject oldKey = (InternalEObject)key;
3
      InternalEObject oldData = (InternalEObject)data;
4
      key = (ENamedElement)eResolveProxy(oldKey);
4
      data = eResolveProxy(oldData);
5
      if (key != oldKey)
5
      if (data != oldData)
6
      {
6
      {
7
        if (eNotificationRequired())
7
        if (eNotificationRequired())
8
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Ecore2XMLPackage.ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__KEY, oldKey, key));
8
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreePackage.TREE_NODE__DATA, oldData, data));
9
      }
9
      }
10
    }
10
    }
11
    return key;
11
    return data;
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (key != null && key.eIsProxy())
    1
    if (key != null && key.eIsProxy())
    1
    if (data != null && data.eIsProxy())
    Differences
    Expression1Expression2Difference
    keydataVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.ENamedElementorg.eclipse.emf.ecore.EObjectVARIABLE_TYPE_MISMATCH
    keydataVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.ENamedElementorg.eclipse.emf.ecore.EObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    • Make classes org.eclipse.emf.ecore.ENamedElement and org.eclipse.emf.ecore.EObject extend a common superclass
    Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    • Make classes org.eclipse.emf.ecore.ENamedElement and org.eclipse.emf.ecore.EObject extend a common superclass
    1
    if (data != null && data.eIsProxy())
    2
    InternalEObject oldKey = (InternalEObject)key;
    2
    InternalEObject oldKey = (InternalEObject)key;
    2
    InternalEObject oldData = (InternalEObject)data;
    Differences
    Expression1Expression2Difference
    oldKeyoldDataVARIABLE_NAME_MISMATCH
    keydataVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.ENamedElementorg.eclipse.emf.ecore.EObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    • Make classes org.eclipse.emf.ecore.ENamedElement and org.eclipse.emf.ecore.EObject extend a common superclass
    2
    InternalEObject oldData = (InternalEObject)data;
                                                                  
    3
    data = eResolveProxy(oldData);
    Preondition Violations
    Unmatched statement data=eResolveProxy(oldData); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    data = eResolveProxy(oldData);
    3
    key = (ENamedElement)eResolveProxy(oldKey);
    3
    key = (ENamedElement)eResolveProxy(oldKey);
    Preondition Violations
    Unmatched statement key=(ENamedElement)eResolveProxy(oldKey); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    4
    if (key != oldKey)
    4
    if (key != oldKey)
    4
    if (data != oldData)
    Differences
    Expression1Expression2Difference
    keydataVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.ENamedElementorg.eclipse.emf.ecore.EObjectVARIABLE_TYPE_MISMATCH
    oldKeyoldDataVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    • Make classes org.eclipse.emf.ecore.ENamedElement and org.eclipse.emf.ecore.EObject extend a common superclass
    4
    if (data != oldData)
    5
    if (eNotificationRequired())
    5
    if (eNotificationRequired())
    6
    eNotify(new ENotificationImpl(this, Notification.RESOLVE, Ecore2XMLPackage.ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__KEY, oldKey, key));
    6
    eNotify(new ENotificationImpl(this, Notification.RESOLVE, Ecore2XMLPackage.ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__KEY, oldKey, key));
    6
    eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreePackage.TREE_NODE__DATA, oldData, data));
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackageorg.eclipse.emf.edit.tree.TreePackageVARIABLE_TYPE_MISMATCH
    ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__KEYTREE_NODE__DATAVARIABLE_NAME_MISMATCH
    oldKeyoldDataVARIABLE_NAME_MISMATCH
    keydataVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.ENamedElementorg.eclipse.emf.ecore.EObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage of variable Ecore2XMLPackage does not match with type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage
    • Make classes org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage and org.eclipse.emf.edit.tree.TreePackage extend a common superclass
    Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    • Make classes org.eclipse.emf.ecore.ENamedElement and org.eclipse.emf.ecore.EObject extend a common superclass
    6
    eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreePackage.TREE_NODE__DATA, oldData, data));
                                  
    7
    return data;
    Preondition Violations
    Unmatched return data;
    7
    return data;
    7
    return key;
    7
    return key;
    Preondition Violations
    Unmatched return key;
                                
    Precondition Violations (10)
    Row Violation
    1Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    2Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    3Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    4Unmatched statement data=eResolveProxy(oldData); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement key=(ENamedElement)eResolveProxy(oldKey); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    7Type org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage of variable Ecore2XMLPackage does not match with type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage
    8Type org.eclipse.emf.ecore.ENamedElement of variable key does not match with type org.eclipse.emf.ecore.EObject of variable data
    9Unmatched return data;
    10Unmatched return key;