11436-2-6

if (diagnostics == null) { return false; } else { result = false; diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_NS_URIS, "_UI_EPackageUniqueNsURIs_diagnostic", new Object[] { nsURI }, new Object[] { ePackage, otherEPackage }, context)); }
if (diagnostics == null) { return false; } else { result = false; diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_KEYS, "_UI_EReferenceConsistentKeys_diagnostic", new Object[] { getObjectLabel(eAttribute, context) }, new Object[] { eReference, eAttribute }, context)); }

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreValidator.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreValidator.java
Method name: `boolean validateEPackage_UniqueNsURIs(EPackage, DiagnosticChain, Map)` |  | Method name: `boolean validateEReference_ConsistentKeys(EReference, DiagnosticChain, Map)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    if (diagnostics == null)↵

1

    if (diagnostics == null)↵

2

              {↵

2

              ↵

3

      {↵

3

                return false;↵

4

                  return false;↵

4

              }↵

5

              ↵

6

      }↵

5

              else↵

7

                else↵

6

              {↵

8

                {↵

7

                result = false;↵

9

                  result = false;↵

8

                diagnostics.add↵

10

                  diagnostics.add↵

9

                  (createDiagnostic↵

11

                    (createDiagnostic↵

10

                    (Diagnostic.ERROR,↵

12

                      (Diagnostic.ERROR,↵

11

                     DIAGNOSTIC_SOURCE,↵

13

                       DIAGNOSTIC_SOURCE,↵

12

                     UNIQUE_NS_URIS,↵

14

                       CONSISTENT_KEYS,↵

13

                     "_UI_EPackageUniqueNsURIs_diagnostic", ↵

15

                       "_UI_EReferenceConsistentKeys_diagnostic",↵

14

                     new Object[] { nsURI },↵

16

                       new Object[] { getObjectLabel(eAttribute, context) },↵

15

                     new Object[] { ePackage, otherEPackage },↵

17

                       new Object[] { eReference, eAttribute },↵

16

                     context));↵

18

                       context));↵

17

              }

19

                }

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 declared in the same class
Number of node comparisons | 18

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 3
   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) | 2.4
   Clone type | Type 2

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

   14

       if (diagnostics == null)

   8

       if (diagnostics == null)

   15

       return false;

   9

       return false;

       else

       else

   16

       result = false;

   10

       result = false;

   11 | diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_KEYS, "_UI_EReferenceConsistentKeys_diagnostic", new Object[] {getObjectLabel(eAttribute, context)}, new Object[] {eReference, eAttribute}, context));

   Preondition Violations
   Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,CONSISTENT_KEYS,"_UI_EReferenceConsistentKeys_diagnostic",new Object[]{getObjectLabel(eAttribute,context)},new Object[]{eReference,eAttribute},context)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   11

       diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_KEYS, "_UI_EReferenceConsistentKeys_diagnostic", new Object[] {getObjectLabel(eAttribute, context)}, new Object[] {eReference, eAttribute}, context));

   17

       diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_NS_URIS, "_UI_EPackageUniqueNsURIs_diagnostic", new Object[] {nsURI}, new Object[] {ePackage, otherEPackage}, context));

   17 | diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_NS_URIS, "_UI_EPackageUniqueNsURIs_diagnostic", new Object[] {nsURI}, new Object[] {ePackage, otherEPackage}, context));

   Preondition Violations
   Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,UNIQUE_NS_URIS,"_UI_EPackageUniqueNsURIs_diagnostic",new Object[]{nsURI},new Object[]{ePackage,otherEPackage},context)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,CONSISTENT_KEYS,"_UI_EReferenceConsistentKeys_diagnostic",new Object[]{getObjectLabel(eAttribute,context)},new Object[]{eReference,eAttribute},context)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   2 | Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,UNIQUE_NS_URIS,"_UI_EPackageUniqueNsURIs_diagnostic",new Object[]{nsURI},new Object[]{ePackage,otherEPackage},context)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted