173-118-184

if (packageRegistry == null) { packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); } return packageRegistry;
if (registry == null) { registry = new EPackageRegistryImpl(); } return new BasicExtendedMetaData(registry);

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/util/XMLProcessor.java
Method name: `EPackage.Registry getPackageRegistry()` |  | Method name: `ExtendedMetaData createExtendedMetaData()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (packageRegistry == null)↵

1

    if (registry == null)↵

2

        {↵

2

        {↵

3

          packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);↵

3

          registry = new EPackageRegistryImpl(↵

4

        }↵

5

        return packageR↵

4

    );↵

5

        }↵

6

    egistry;

6

        return new BasicExtendedMetaData(registry);

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.1
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) | 0.4
   Clone type | Type 2

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

   1

       if (packageRegistry == null)

   1 | if (packageRegistry == null)
   1 | if (registry == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   packageRegistry | registry | VARIABLE_NAME_MISMATCH

   1

       if (registry == null)

   2

       packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);

   2 | packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
   2 | registry = new EPackageRegistryImpl();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   packageRegistry | registry | VARIABLE_NAME_MISMATCH
   new EPackageRegistryImpl(EPackage.Registry.INSTANCE) | new EPackageRegistryImpl() | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression packageRegistry is a field being modified, and thus it cannot be parameterized
   Expression registry is a field being modified, and thus it cannot be parameterized

   2

       registry = new EPackageRegistryImpl();

   3

       return new BasicExtendedMetaData(registry);

   3

       return packageRegistry;

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression packageRegistry is a field being modified, and thus it cannot be parameterized
   2 | Expression registry is a field being modified, and thus it cannot be parameterized