String typeParameterNames = getModelAnnotationAttribute(methodAnnotation, "typeParameters"); if (typeParameterNames != null) { for (StringTokenizer stringTokenizer = new StringTokenizer(typeParameterNames, " "); stringTokenizer.hasMoreTokens();) { String typeParameterName = stringTokenizer.nextToken(); ETypeParameter eTypeParameter = EcoreFactory.eINSTANCE.createETypeParameter(); eTypeParameter.setName(typeParameterName); String typeParameterModelAnnotation = getFilteredModelAnnotations(methodAnnotation, typeParameterName); String bounds = getModelAnnotationAttribute(typeParameterModelAnnotation, "bounds"); if (bounds != null) { eTypeParameter.getEBounds().addAll(analyzeEGenericTypes(bounds)); for (EGenericType eBound : eTypeParameter.getEBounds()) { ecoreEGenericTypeToJavaEGenericTypeMap.put(eBound, null); } } eDataType.getETypeParameters().add(eTypeParameter); } } eDataTypes.add(eDataType);
String typeParameterNames = getModelAnnotationAttribute(methodAnnotation, "typeParameters"); if (typeParameterNames != null) { for (StringTokenizer stringTokenizer = new StringTokenizer(typeParameterNames, " "); stringTokenizer.hasMoreTokens();) { String typeParameterName = stringTokenizer.nextToken(); ETypeParameter eTypeParameter = EcoreFactory.eINSTANCE.createETypeParameter(); eTypeParameter.setName(typeParameterName); String typeParameterModelAnnotation = getFilteredModelAnnotations(methodAnnotation, typeParameterName); String bounds = getModelAnnotationAttribute(typeParameterModelAnnotation, "bounds"); if (bounds != null) { eTypeParameter.getEBounds().addAll(analyzeEGenericTypes(bounds)); for (EGenericType eBound : eTypeParameter.getEBounds()) { ecoreEGenericTypeToJavaEGenericTypeMap.put(eBound, null); } } eClass.getETypeParameters().add(eTypeParameter); } } eClasses.add(eClass);
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/importer/java/builder/JavaEcoreBuilder.java File path: /emf-2.4.1/src/org/eclipse/emf/importer/java/builder/JavaEcoreBuilder.java
Method name: void analyzeType(JType) Method name: void analyzeType(JType)
Number of AST nodes: 14 Number of AST nodes: 14
1
String typeParameterNames = getModelAnnotationAttribute(methodAnnotation, "typeParameters");
1
String typeParameterNames = getModelAnnotationAttribute(methodAnnotation, "typeParameters");
2
                  if (typeParameterNames != null)
2
                    if (typeParameterNames != null)
3
                  {
3
                  
4
  {
4
                    for (StringTokenizer stringTokenizer = new StringTokenizer(typeParameterNames, " "); stringTokenizer.hasMoreTokens();)
5
                      for (StringTokenizer stringTokenizer = new StringTokenizer(typeParameterNames, " "); stringTokenizer.hasMoreTokens();)
5
                    {
6
                    
7
  {
6
                      String typeParameterName = stringTokenizer.nextToken();
8
                        String typeParameterName = stringTokenizer.nextToken();
7
                      ETypeParameter eTypeParameter = EcoreFactory.eINSTANCE.createETypeParameter();
9
                        ETypeParameter eTypeParameter = EcoreFactory.eINSTANCE.createETypeParameter();
8
                      eTypeParameter.setName(typeParameterName);
10
                        eTypeParameter.setName(typeParameterName);
9
                      String typeParameterModelAnnotation = getFilteredModelAnnotations(methodAnnotation, typeParameterName);
11
                        String typeParameterModelAnnotation = getFilteredModelAnnotations(methodAnnotation, typeParameterName);
10
                      String bounds = getModelAnnotationAttribute(typeParameterModelAnnotation, "bounds");
12
                        String bounds = getModelAnnotationAttribute(typeParameterModelAnnotation, "bounds");
11
                      if (bounds != null)
13
                        if (bounds != null)
12
                      {
14
                      
15
  {
13
                        eTypeParameter.getEBounds().addAll(analyzeEGenericTypes(bounds));
16
                          eTypeParameter.getEBounds().addAll(analyzeEGenericTypes(bounds));
14
                        for (EGenericType eBound : eTypeParameter.getEBounds())
17
                          for (EGenericType eBound : eTypeParameter.getEBounds())
15
                        {
18
                          {
16
                          ecoreEGenericTypeToJavaEGenericTypeMap.put(eBound, null);
19
                            ecoreEGenericTypeToJavaEGenericTypeMap.put(eBound, null);
17
                        }
20
                        
21
  }
18
                      }
22
                        }
23
  
19
                      eDataType.getETypeParameters().add(eTypeParameter);
24
                        eClass.getETypeParameters().add(eTypeParameter);
20
                    }
25
                    
26
  }
21
                  }
27
                    }
22
                  eDataTypes.add(eDataType);
28
                    eClasses.add(eClass);
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.6
Clones locationClones are in the same method
Number of node comparisons70
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)52.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    131
    String typeParameterNames = getModelAnnotationAttribute(methodAnnotation, "typeParameters");
    155
    String typeParameterNames = getModelAnnotationAttribute(methodAnnotation, "typeParameters");
    132
    if (typeParameterNames != null)
    156
    if (typeParameterNames != null)
    133
    for (StringTokenizer stringTokenizer = new StringTokenizer(typeParameterNames, " "); stringTokenizer.hasMoreTokens(); )
    157
    for (StringTokenizer stringTokenizer = new StringTokenizer(typeParameterNames, " "); stringTokenizer.hasMoreTokens(); )
    134
    String typeParameterName = stringTokenizer.nextToken();
    158
    String typeParameterName = stringTokenizer.nextToken();
    135
    ETypeParameter eTypeParameter = EcoreFactory.eINSTANCE.createETypeParameter();
    159
    ETypeParameter eTypeParameter = EcoreFactory.eINSTANCE.createETypeParameter();
    136
    eTypeParameter.setName(typeParameterName);
    160
    eTypeParameter.setName(typeParameterName);
    137
    String typeParameterModelAnnotation = getFilteredModelAnnotations(methodAnnotation, typeParameterName);
    161
    String typeParameterModelAnnotation = getFilteredModelAnnotations(methodAnnotation, typeParameterName);
    138
    String bounds = getModelAnnotationAttribute(typeParameterModelAnnotation, "bounds");
    162
    String bounds = getModelAnnotationAttribute(typeParameterModelAnnotation, "bounds");
    139
    if (bounds != null)
    163
    if (bounds != null)
    140
    eTypeParameter.getEBounds().addAll(analyzeEGenericTypes(bounds));
    164
    eTypeParameter.getEBounds().addAll(analyzeEGenericTypes(bounds));
    141
    for (EGenericType eBound : eTypeParameter.getEBounds())
    165
    for (EGenericType eBound : eTypeParameter.getEBounds())
    142
    ecoreEGenericTypeToJavaEGenericTypeMap.put(eBound, null);
    166
    ecoreEGenericTypeToJavaEGenericTypeMap.put(eBound, null);
    143
    eDataType.getETypeParameters().add(eTypeParameter);
    143
    eDataType.getETypeParameters().add(eTypeParameter);
    167
    eClass.getETypeParameters().add(eTypeParameter);
    Differences
    Expression1Expression2Difference
    eDataTypeeClassVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EDataTypeorg.eclipse.emf.ecore.EClassVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EDataType of variable eDataType does not match with type org.eclipse.emf.ecore.EClass of variable eClass
    • Make classes org.eclipse.emf.ecore.EDataType and org.eclipse.emf.ecore.EClass extend a common superclass
    167
    eClass.getETypeParameters().add(eTypeParameter);
    144
    eDataTypes.add(eDataType);
    144
    eDataTypes.add(eDataType);
    168
    eClasses.add(eClass);
    Differences
    Expression1Expression2Difference
    eDataTypeeClassVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EDataTypeorg.eclipse.emf.ecore.EClassVARIABLE_TYPE_MISMATCH
    eDataTypeseClassesVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EDataType of variable eDataType does not match with type org.eclipse.emf.ecore.EClass of variable eClass
    • Make classes org.eclipse.emf.ecore.EDataType and org.eclipse.emf.ecore.EClass extend a common superclass
    Type java.util.List<org.eclipse.emf.ecore.EDataType> of variable eDataTypes does not match with type java.util.List<org.eclipse.emf.ecore.EClass> of variable eClasses
    • Make classes java.util.List and java.util.List extend a common superclass
    168
    eClasses.add(eClass);
    Precondition Violations (3)
    Row Violation
    1Type org.eclipse.emf.ecore.EDataType of variable eDataType does not match with type org.eclipse.emf.ecore.EClass of variable eClass
    2Type org.eclipse.emf.ecore.EDataType of variable eDataType does not match with type org.eclipse.emf.ecore.EClass of variable eClass
    3Type java.util.List<org.eclipse.emf.ecore.EDataType> of variable eDataTypes does not match with type java.util.List<org.eclipse.emf.ecore.EClass> of variable eClasses