173-49-52

if (workspaceFile == null) { workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation())); } return workspaceFile;
if (projectDescriptors == null) { loadFromExtensionPoints(); } return projectDescriptors;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/wizard/AbstractExampleInstallerWizard.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/wizard/ExampleInstallerWizard.java
Method name: `IFile getWorkspaceFile()` |  | Method name: `List getProjectDescriptors()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (workspaceFile == null)↵

1

    if (projectDescriptors == null)↵

2

          {↵

2

        {↵

3

            workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));↵

3

          ↵

4

      ↵

4

    loadFromExtensionPoints();↵

5

        }↵

5

        }↵

6

          return workspaceFile;

6

        return projectDescriptors;

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) | 1.7
   Clone type | Type 2

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

   1

       if (workspaceFile == null)

   1 | if (workspaceFile == null)
   1 | if (projectDescriptors == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   workspaceFile | projectDescriptors | VARIABLE_NAME_MISMATCH
   org.eclipse.core.resources.IFile | java.util.List | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.eclipse.core.resources.IFile of variable workspaceFile does not match with type java.util.List<org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor> of variable projectDescriptors
   - Make classes org.eclipse.core.resources.IFile and java.util.List extend a common superclass

   1

       if (projectDescriptors == null)

   2 | loadFromExtensionPoints();

   Preondition Violations
   Unmatched statement loadFromExtensionPoints(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   Unmatched statement loadFromExtensionPoints(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted

   2

       loadFromExtensionPoints();

   2

       workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));

   2 | workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));

   Preondition Violations
   Unmatched statement workspaceFile=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation())); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   3 | return projectDescriptors;

   Preondition Violations
   Unmatched return projectDescriptors;

   3

       return projectDescriptors;

   3

       return workspaceFile;

   3 | return workspaceFile;

   Preondition Violations
   Unmatched return workspaceFile;

   Precondition Violations (7)
   Row | Violation
   --- | ---
   1 | Type org.eclipse.core.resources.IFile of variable workspaceFile does not match with type java.util.List<org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor> of variable projectDescriptors
   2 | Unmatched statement loadFromExtensionPoints(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | Unmatched statement loadFromExtensionPoints(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
   4 | Unmatched statement workspaceFile=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation())); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   5 | Unmatched return projectDescriptors;
   6 | Unmatched return workspaceFile;
   7 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero