173-115-206

if (children == null) { children = new EObjectContainmentWithInverseEList<TreeNode>(TreeNode.class, this, TreePackage.TREE_NODE__CHILDREN, TreePackage.TREE_NODE__PARENT); } return children;
if (result == null) { result = new ArrayList<EStructuralFeature>(); } result.add(eStructuralFeature);

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/tree/impl/TreeNodeImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java
Method name: `EList getChildren()` |  | Method name: `List getAttributes(EClass)`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (children == null)↵

1

    if (result == null)↵

2

        {↵

2

              {↵

3

          children = new EObjectContainmentWithInverseEList<TreeNode>(TreeNode.class, this, TreePackage.TREE_NODE__CHILDREN, TreePackage.TREE_NODE__PARENT);↵

3

          ↵

4

          result = new ArrayList<EStructuralFeature>();↵

4

        }↵

5

              }↵

5

        return children;

6

              result.add(eStructuralFeature);

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 | 2
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 17.6
   Clone type | Type 2

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

   1

       if (children == null)

   1 | if (children == null)
   8 | if (result == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   children | result | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.common.util.EList | java.util.List | SUBCLASS_TYPE_MISMATCH

   8

       if (result == null)

   2

       children = new EObjectContainmentWithInverseEList<TreeNode>(TreeNode.class, this, TreePackage.TREE_NODE__CHILDREN, TreePackage.TREE_NODE__PARENT);

   2 | children = new EObjectContainmentWithInverseEList<TreeNode>(TreeNode.class, this, TreePackage.TREE_NODE__CHILDREN, TreePackage.TREE_NODE__PARENT);
   9 | result = new ArrayList<EStructuralFeature>();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   children | result | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.common.util.EList | java.util.List | SUBCLASS_TYPE_MISMATCH
   org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList | java.util.ArrayList | SUBCLASS_TYPE_MISMATCH
   org.eclipse.emf.edit.tree.TreeNode | org.eclipse.emf.ecore.EStructuralFeature | SUBCLASS_TYPE_MISMATCH
   new EObjectContainmentWithInverseEList(TreeNode.class,this,TreePackage.TREE_NODE__CHILDREN,TreePackage.TREE_NODE__PARENT) | new ArrayList() | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression new EObjectContainmentWithInverseEList<TreeNode>(TreeNode.class,this,TreePackage.TREE_NODE__CHILDREN,TreePackage.TREE_NODE__PARENT) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   9

       result = new ArrayList<EStructuralFeature>();

   3

       return children;

   10 | result.add(eStructuralFeature);

   Preondition Violations
   Unmatched statement result.add(eStructuralFeature); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   10

       result.add(eStructuralFeature);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression new EObjectContainmentWithInverseEList<TreeNode>(TreeNode.class,this,TreePackage.TREE_NODE__CHILDREN,TreePackage.TREE_NODE__PARENT) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement result.add(eStructuralFeature); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables result
   4 | The refactoring of the clones is infeasible, because classes org.eclipse.emf.edit.tree.impl.TreeNodeImpl and org.eclipse.emf.ecore.util.BasicExtendedMetaData do not have a common superclass