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)); } }
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)); } }
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 validateEClass_ConsistentSuperTypes(EClass, DiagnosticChain, Map)
Number of AST nodes: 7 Number of AST nodes: 6
1
int index = names.indexOf(name);
1
int index = superTypes.indexOf(eClassifier);
2
        if (index != -1)
2
        if (index != -1)
3
        {
3
        {
4
          if (diagnostics == null)
4
          if (diagnostics == null)
5
          {
5
          {
6
            return false;
6
            return false;
7
          }
7
          }
8
          else
8
          else
9
          {
9
          {
10
            result = false;
10
            result = false;
11
            ETypeParameter otherETypeParameter = eTypeParameters.get(index);
12
            diagnostics.add
11
            diagnostics.add
13
              (createDiagnostic
12
              (createDiagnostic
14
                (Diagnostic.ERROR,
13
                (Diagnostic.ERROR,
15
                 DIAGNOSTIC_SOURCE,
14
                 DIAGNOSTIC_SOURCE,
16
                 UNIQUE_TYPE_PARAMETER_NAMES,
15
                 
17
                 "_UI_UniqueTypeParameterNam
16
CONSISTENT_SUPER_TYPES_DUPLICATE,
18
es_diagnostic", 
17
                 "_UI_EClassNoDuplicateSuperTypes_diagnostic",
19
                 new Object[] { name },
18
                 new Object [] { eGenericSuperTypes.indexOf(eGenericSuperType), index },
20
                 new Object[] { eClassifier, eTypeParameter, otherETypeParameter },
19
                 new Object[] { eClass, eGenericSuperType,  eGenericSuperTypes.get(index) },
21
                 context));
20
                 context));
22
          }
21
          }
23
        }
22
        }
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.2
Clones locationClones are declared in the same class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    int index = names.indexOf(name);
    7
    int index = names.indexOf(name);
    7
    int index = superTypes.indexOf(eClassifier);
    Differences
    Expression1Expression2Difference
    nameeClassifierVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.eclipse.emf.ecore.EClassifierVARIABLE_TYPE_MISMATCH
    namessuperTypesVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable name does not match with type org.eclipse.emf.ecore.EClassifier of variable eClassifier
    • Make classes java.lang.String and org.eclipse.emf.ecore.EClassifier extend a common superclass
    Type java.util.List<java.lang.String> of variable names does not match with type java.util.ArrayList<org.eclipse.emf.ecore.EClassifier> of variable superTypes
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    7
    int index = superTypes.indexOf(eClassifier);
    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
    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));
    Preondition Violations
    Unmatched statement 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)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    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
    ETypeParameter otherETypeParameter = eTypeParameters.get(index);
    12
    ETypeParameter otherETypeParameter = eTypeParameters.get(index);
    Preondition Violations
    Unmatched statement ETypeParameter otherETypeParameter=eTypeParameters.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                        
    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));
    Preondition Violations
    Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,UNIQUE_TYPE_PARAMETER_NAMES,"_UI_UniqueTypeParameterNames_diagnostic",new Object[]{name},new Object[]{eClassifier,eTypeParameter,otherETypeParameter},context)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    Precondition Violations (6)
    Row Violation
    1Type java.lang.String of variable name does not match with type org.eclipse.emf.ecore.EClassifier of variable eClassifier
    2Type java.util.List<java.lang.String> of variable names does not match with type java.util.ArrayList<org.eclipse.emf.ecore.EClassifier> of variable superTypes
    3Unmatched statement 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)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement ETypeParameter otherETypeParameter=eTypeParameters.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,UNIQUE_TYPE_PARAMETER_NAMES,"_UI_UniqueTypeParameterNames_diagnostic",new Object[]{name},new Object[]{eClassifier,eTypeParameter,otherETypeParameter},context)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Clone fragment #1 returns variables index, result , while Clone fragment #2 returns variables index, result