for (ETypeParameter eTypeParameter : eTypeParameters) { String name = eTypeParameter.getName(); if (name != null) { int index = names.indexOf(name); if (index != -1) { if (diagnostics == null) { return false; } else { result = false; ETypeParameter otherETypeParameter = eTypeParameters.get(index); diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_TYPE_PARAMETER_NAMES, "_UI_UniqueTypeParameterNames_diagnostic", new Object[] { name }, new Object[] { eClassifier, eTypeParameter, otherETypeParameter }, context)); } } } names.add(name); } return result;
for (ETypeParameter eTypeParameter : eTypeParameters) { String name = eTypeParameter.getName(); if (name != null) { int index = names.indexOf(name); if (index != -1) { if (diagnostics == null) { return false; } else { result = false; ETypeParameter otherETypeParameter = eTypeParameters.get(index); diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_TYPE_PARAMETER_NAMES, "_UI_UniqueTypeParameterNames_diagnostic", new Object[] { name }, new Object[] { eOperation, eTypeParameter, otherETypeParameter }, context)); } } } names.add(name); } return result;
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 validateEClassifier_UniqueTypeParameterNames(EClassifier, DiagnosticChain, Map) Method name: boolean validateEOperation_UniqueTypeParameterNames(EOperation, DiagnosticChain, Map)
Number of AST nodes: 12 Number of AST nodes: 12
1
for (ETypeParameter eTypeParameter : eTypeParameters)
1
for (ETypeParameter eTypeParameter : eTypeParameters)
2
    {
2
    {
3
      String name = eTypeParameter.getName();
3
      String name = eTypeParameter.getName();
4
      if (name != null)
4
      if (name != null)
5
      {
5
      {
6
        int index = names.indexOf(name);
6
        int index = names.indexOf(name);
7
        if (index != -1)
7
        if (index != -1)
8
        {
8
        {
9
          if (diagnostics == null)
9
          if (diagnostics == null)
10
          {
10
          {
11
            return false;
11
            return false;
12
          }
12
          }
13
          else
13
          else
14
          {
14
          {
15
            result = false;
15
            result = false;
16
            ETypeParameter otherETypeParameter = eTypeParameters.get(index);
16
            ETypeParameter otherETypeParameter = eTypeParameters.get(index);
17
            diagnostics.add
17
            diagnostics.add
18
              (createDiagnostic
18
              (createDiagnostic
19
                (Diagnostic.ERROR,
19
                (Diagnostic.ERROR,
20
                 DIAGNOSTIC_SOURCE,
20
                 DIAGNOSTIC_SOURCE,
21
                 UNIQUE_TYPE_PARAMETER_NAMES,
21
                 UNIQUE_TYPE_PARAMETER_NAMES,
22
                 "_UI_UniqueTypeParameterNames_diagnostic", 
22
                 "_UI_UniqueTypeParameterNames_diagnostic", 
23
                 new Object[] { name },
23
                 new Object[] { name },
24
                 new Object[] { eClassifier, eTypeParameter, otherETypeParameter },
24
                 new Object[] { eOperation, eTypeParameter, otherETypeParameter },
25
                 context));
25
                 context));
26
          }
26
          }
27
        }
27
        }
28
      }
28
      }
29
      names.add(name);
29
      names.add(name);
30
    }
30
    }
31
    return result;
31
    return result;
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.4
Clones locationClones are declared in the same class
Number of node comparisons40
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (ETypeParameter eTypeParameter : eTypeParameters)
    4
    for (ETypeParameter eTypeParameter : eTypeParameters)
    5
    String name = eTypeParameter.getName();
    5
    String name = eTypeParameter.getName();
    6
    if (name != null)
    6
    if (name != null)
    7
    int index = names.indexOf(name);
    7
    int index = names.indexOf(name);
    8
    if (index != -1)
    8
    if (index != -1)
    9
    if (diagnostics == null)
    9
    if (diagnostics == null)
    10
    return false;
    10
    return false;
    else
    else
    11
    result = false;
    11
    result = false;
    12
    ETypeParameter otherETypeParameter = eTypeParameters.get(index);
    12
    ETypeParameter otherETypeParameter = eTypeParameters.get(index);
    13
    diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_TYPE_PARAMETER_NAMES, "_UI_UniqueTypeParameterNames_diagnostic", new Object[] {name}, new Object[] {eClassifier, eTypeParameter, otherETypeParameter}, context));
    13
    diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_TYPE_PARAMETER_NAMES, "_UI_UniqueTypeParameterNames_diagnostic", new Object[] {name}, new Object[] {eClassifier, eTypeParameter, otherETypeParameter}, context));
    13
    diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_TYPE_PARAMETER_NAMES, "_UI_UniqueTypeParameterNames_diagnostic", new Object[] {name}, new Object[] {eOperation, eTypeParameter, otherETypeParameter}, context));
    Differences
    Expression1Expression2Difference
    eClassifiereOperationVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EClassifierorg.eclipse.emf.ecore.EOperationVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EClassifier of variable eClassifier does not match with type org.eclipse.emf.ecore.EOperation of variable eOperation
    • Make classes org.eclipse.emf.ecore.EClassifier and org.eclipse.emf.ecore.EOperation extend a common superclass
    13
    diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_TYPE_PARAMETER_NAMES, "_UI_UniqueTypeParameterNames_diagnostic", new Object[] {name}, new Object[] {eOperation, eTypeParameter, otherETypeParameter}, context));
    14
    names.add(name);
    14
    names.add(name);
    15
    return result;
    15
    return result;
    Precondition Violations (1)
    Row Violation
    1Type org.eclipse.emf.ecore.EClassifier of variable eClassifier does not match with type org.eclipse.emf.ecore.EOperation of variable eOperation