173-49-96

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

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/converter/ModelConverter.java
Method name: `IFile getWorkspaceFile()` |  | Method name: `List getReferencedGenPackages()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (workspaceFile == null)↵

1

    if (referencedGenPackages == null)↵

2

          {↵

2

        ↵

3

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

3

    {↵

4

    );↵

4

          referencedGenPackages = createReferencedGenPackagesList();↵

5

          }↵

5

        }↵

6

          return workspaceFile;

6

        return referencedGenPackages;

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.6
   Clone type | Type 2

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

   1

       if (workspaceFile == null)

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   workspaceFile | referencedGenPackages | 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.codegen.ecore.genmodel.GenPackage> of variable referencedGenPackages
   - Make classes org.eclipse.core.resources.IFile and java.util.List extend a common superclass

   1

       if (referencedGenPackages == null)

   2 | referencedGenPackages = createReferencedGenPackagesList();

   Preondition Violations
   Unmatched statement referencedGenPackages=createReferencedGenPackagesList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   2

       referencedGenPackages = createReferencedGenPackagesList();

   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 referencedGenPackages;

   Preondition Violations
   Unmatched return referencedGenPackages;

   3

       return referencedGenPackages;

   3

       return workspaceFile;

   3 | return workspaceFile;

   Preondition Violations
   Unmatched return workspaceFile;

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Type org.eclipse.core.resources.IFile of variable workspaceFile does not match with type java.util.List<org.eclipse.emf.codegen.ecore.genmodel.GenPackage> of variable referencedGenPackages
   2 | Unmatched statement referencedGenPackages=createReferencedGenPackagesList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | 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
   4 | Unmatched return referencedGenPackages;
   5 | Unmatched return workspaceFile;
   6 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero