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);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in the same method
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.9
    Clone typeType 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;
    10
    return false;
    23
    return false;
    Preondition Violations
    Conditional return false;
    Conditional 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
    Expression1Expression2Difference
    CONSISTENT_SUPER_TYPES_DUPLICATECONSISTENT_SUPER_TYPES_CONFLICTVARIABLE_NAME_MISMATCH
    "_UI_EClassNoDuplicateSuperTypes_diagnostic""_UI_EClassConsistentSuperTypes_diagnostic"LITERAL_VALUE_MISMATCH
    {eGenericSuperTypes.indexOf(eGenericSuperType),index}{getObjectLabel(eClassifier,context)}ARRAY_INITIALIZER_EXPRESSION_NUMBER_MISMATCH
    eGenericSuperTypeseAllGenericSuperTypesVARIABLE_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 (4)
    Row Violation
    1Expression new Object[]{eGenericSuperTypes.indexOf(eGenericSuperType),index} cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new Object[]{getObjectLabel(eClassifier,context)} cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Conditional return false;
    4Conditional return false;