137-1-2

EClassifier eClassifier = eGenericSuperType.getEClassifier(); if (eClassifier instanceof EClass) { int index = superTypes.indexOf(eClassifier); if (index != -1) { if (diagnostics == null) { return false; } else { result = false; diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_SUPER_TYPES_DUPLICATE, "_UI_EClassNoDuplicateSuperTypes_diagnostic", new Object [] { eGenericSuperTypes.indexOf(eGenericSuperType), index }, new Object[] { eClass, eGenericSuperType, eGenericSuperTypes.get(index) }, context)); } } } superTypes.add(eClassifier);
EClassifier eClassifier = eGenericSuperType.getEClassifier(); if (eClassifier instanceof EClass) { int index = superTypes.indexOf(eClassifier); if (index != -1) { if (diagnostics == null) { return false; } else { result = false; diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_SUPER_TYPES_CONFLICT, "_UI_EClassConsistentSuperTypes_diagnostic", new Object [] { getObjectLabel(eClassifier, context) }, new Object[] { eClass, eGenericSuperType, eAllGenericSuperTypes.get(index) }, context)); } } } superTypes.add(eClassifier);

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 validateEClass_ConsistentSuperTypes(EClass, DiagnosticChain, Map)` |  | Method name: `boolean validateEClass_ConsistentSuperTypes(EClass, DiagnosticChain, Map)`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    EClassifier eClassifier = eGenericSuperType.getEClassifier();↵

1

    EClassifier eClassifier = eGenericSuperType.getEClassifier();↵

2

          if (eClassifier instanceof EClass)↵

2

            if (eClassifier instanceof EClass)↵

3

          {↵

3

            {↵

4

            int index = superTypes.indexOf(eClassifier);↵

4

              int index = superTypes.indexOf(eClassifier);↵

5

            if (index != -1)↵

5

              if (index != -1)↵

6

            {↵

6

              {↵

7

              if (diagnostics == null)↵

7

                if (diagnostics == null)↵

8

              {↵

8

              ↵

9

      {↵

9

                return false;↵

10

                  return false;↵

10

              }↵

11

                }↵

11

              else↵

12

                else↵

12

              {↵

13

                {↵

13

                result = false;↵

14

                  result = false;↵

14

                diagnostics.add↵

15

                  diagnostics.add↵

15

                  (createDiagnostic↵

16

                    (createDiagnostic↵

16

                    (Diagnostic.ERROR,↵

17

                      (Diagnostic.ERROR,↵

17

                     DIAGNOSTIC_SOURCE,↵

18

                       DIAGNOSTIC_SOURCE,↵

18

                     CONSISTENT_SUPER_TYPES_DUPLICATE,↵

19

                       CONSISTENT_SUPER_TYPES_↵

20

    CONFLICT,↵

19

                     "_UI_EClassNoDuplicateSuperTypes_diagnostic",↵

21

                       "_UI_EClassConsistentSuperTypes_diagnostic",↵

20

                     new Object [] { eGenericSuperTypes.indexOf(eGenericSuperType), index },↵

22

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

21

                     new Object[] { eClass, eGenericSuperType,  eGenericSuperTypes.get(index) },↵

23

                       new Object[] { eClass, eGenericSuperType,  eAllGenericSuperTypes.get(index) },↵

22

                     context));↵

24

                       context));↵

23

              }↵

25

              ↵

26

      }↵

24

            }↵

27

              }↵

25

          }↵

28

          ↵

29

      }↵

26

          superTypes.add(eClassifier);

30

            superTypes.add(eClassifier);

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.4
Clones location | Clones are in the same method
Number of node comparisons | 27

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 9
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 606.4
   Clone type | Type 2

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

   5

       EClassifier eClassifier = eGenericSuperType.getEClassifier();

   18

       EClassifier eClassifier = eGenericSuperType.getEClassifier();

   6

       if (eClassifier instanceof EClass)

   19

       if (eClassifier instanceof EClass)

   7

       int index = superTypes.indexOf(eClassifier);

   20

       int index = superTypes.indexOf(eClassifier);

   8

       if (index != -1)

   21

       if (index != -1)

   9

       if (diagnostics == null)

   22

       if (diagnostics == null)

   10

       return false;

   23

       return false;

       else

       else

   11

       result = false;

   24

       result = false;

   12

       diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_SUPER_TYPES_DUPLICATE, "_UI_EClassNoDuplicateSuperTypes_diagnostic", new Object[] {eGenericSuperTypes.indexOf(eGenericSuperType), index}, new Object[] {eClass, eGenericSuperType, eGenericSuperTypes.get(index)}, context));

   12 | diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_SUPER_TYPES_DUPLICATE, "_UI_EClassNoDuplicateSuperTypes_diagnostic", new Object[] {eGenericSuperTypes.indexOf(eGenericSuperType), index}, new Object[] {eClass, eGenericSuperType, eGenericSuperTypes.get(index)}, context));
   25 | diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_SUPER_TYPES_CONFLICT, "_UI_EClassConsistentSuperTypes_diagnostic", new Object[] {getObjectLabel(eClassifier, context)}, new Object[] {eClass, eGenericSuperType, eAllGenericSuperTypes.get(index)}, context));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   CONSISTENT_SUPER_TYPES_DUPLICATE | CONSISTENT_SUPER_TYPES_CONFLICT | VARIABLE_NAME_MISMATCH
   "_UI_EClassNoDuplicateSuperTypes_diagnostic" | "_UI_EClassConsistentSuperTypes_diagnostic" | LITERAL_VALUE_MISMATCH
   {eGenericSuperTypes.indexOf(eGenericSuperType),index} | {getObjectLabel(eClassifier,context)} | ARRAY_INITIALIZER_EXPRESSION_NUMBER_MISMATCH
   {eGenericSuperTypes.indexOf(eGenericSuperType),index} | {getObjectLabel(eClassifier,context)} | ARRAY_INITIALIZER_MISMATCH
   eGenericSuperTypes | eAllGenericSuperTypes | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression new Object[]{eGenericSuperTypes.indexOf(eGenericSuperType),index} cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Object[]{getObjectLabel(eClassifier,context)} cannot be parameterized, because it has dependencies to/from statements that will be extracted

   25

       diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, CONSISTENT_SUPER_TYPES_CONFLICT, "_UI_EClassConsistentSuperTypes_diagnostic", new Object[] {getObjectLabel(eClassifier, context)}, new Object[] {eClass, eGenericSuperType, eAllGenericSuperTypes.get(index)}, context));

   13

       superTypes.add(eClassifier);

   26

       superTypes.add(eClassifier);

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Expression new Object[]{eGenericSuperTypes.indexOf(eGenericSuperType),index} cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression new Object[]{getObjectLabel(eClassifier,context)} cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Not all possible execution flows end in a return statement