173-169-172

if (eContents == null) { eContents = EContentsEList.createEContentsEList(this); } return eContents;
if (platformResourceMap == null) { platformResourceMap = new HashMap<String, URI>(); } return platformResourceMap;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/FlatEObjectImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/EcorePlugin.java
Method name: `EList eContents()` |  | Method name: `Map getPlatformResourceMap()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (eContents == null)↵

1

    if (platformResourceMap == null)↵

2

        {↵

2

        {↵

3

          eContents = EContentsEList.createEContentsEList(this);↵

3

          platformResourceMap = new HashMap<String, URI>();↵

4

        }↵

4

        }↵

5

        return eContents;

5

        return platformResourceMap;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are in different classes
Number of node comparisons | 5

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 1
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 0.6
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (eContents == null)

   1 | if (eContents == null)
   1 | if (platformResourceMap == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   eContents | platformResourceMap | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.common.util.EList | java.util.Map | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> of variable eContents does not match with type java.util.Map<java.lang.String,org.eclipse.emf.common.util.URI> of variable platformResourceMap
   - Make classes org.eclipse.emf.common.util.EList and java.util.Map extend a common superclass

   1

       if (platformResourceMap == null)

   2 | platformResourceMap = new HashMap<String, URI>();

   Preondition Violations
   Unmatched statement platformResourceMap=new HashMap<String,URI>(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   2

       platformResourceMap = new HashMap<String, URI>();

   2

       eContents = EContentsEList.createEContentsEList(this);

   2 | eContents = EContentsEList.createEContentsEList(this);

   Preondition Violations
   Unmatched statement eContents=EContentsEList.createEContentsEList(this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   3 | return platformResourceMap;

   Preondition Violations
   Unmatched return platformResourceMap;

   3

       return platformResourceMap;

   3

       return eContents;

   3 | return eContents;

   Preondition Violations
   Unmatched return eContents;

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Type org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> of variable eContents does not match with type java.util.Map<java.lang.String,org.eclipse.emf.common.util.URI> of variable platformResourceMap
   2 | Unmatched statement platformResourceMap=new HashMap<String,URI>(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | Unmatched statement eContents=EContentsEList.createEContentsEList(this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   4 | Unmatched return platformResourceMap;
   5 | Unmatched return eContents;
   6 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero