if (targetNamespaceToURI != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null) { Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object []{ extendedMetaData }); @SuppressWarnings("unchecked") Collection<? extends Resource> result = (Collection<? extends Resource>) XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object []{ targetNamespaceToURI.values() }); return result; } return Collections.emptyList();
if (uris != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null) { Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object []{ extendedMetaData }); @SuppressWarnings("unchecked") Collection<? extends Resource> result = (Collection<? extends Resource>) XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object []{ uris }); return result; } return Collections.emptyList();
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/util/DefaultEcoreBuilder.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/util/DefaultEcoreBuilder.java
Method name: Collection generate(Map) Method name: Collection generate(Collection)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (targetNamespaceToURI != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null)
1
if (uris != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null)
2
    {
2
    {
3
      Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object []{ extendedMetaData });
3
      Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object []{ extendedMetaData });
4
      @SuppressWarnings("unchecked") Collection<? extends Resource> result = (Collection<? extends Resource>)
4
      @SuppressWarnings("unchecked") Collection<? extends Resource> result = (Collection<? extends Resource>)
5
        XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object []{ targetNamespaceToURI.values() });
5
        XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object []{ uris });
6
      return result;
6
      return result;
7
    }
7
    }
8
    return Collections.emptyList();
8
    return Collections.emptyList();
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 comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (targetNamespaceToURI != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null)
    1
    if (targetNamespaceToURI != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null)
    1
    if (uris != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null)
    Differences
    Expression1Expression2Difference
    targetNamespaceToURIurisVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.CollectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<java.lang.String,org.eclipse.emf.common.util.URI> of variable targetNamespaceToURI does not match with type java.util.Collection<org.eclipse.emf.common.util.URI> of variable uris
    • Make classes java.util.Map and java.util.Collection extend a common superclass
    1
    if (uris != null && XSD_ECORE_BUILDER_CONSTRUCTOR != null && XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD != null)
                                                                                                                                                                                                      
    2
    Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[] {extendedMetaData});
    Preondition Violations
    Unmatched statement Object ecoreBuilder=XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[]{extendedMetaData}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[] {extendedMetaData});
    2
    Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[] {extendedMetaData});
    2
    Object ecoreBuilder = XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[] {extendedMetaData});
    Preondition Violations
    Unmatched statement Object ecoreBuilder=XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[]{extendedMetaData}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                                            
    3
    @SuppressWarnings("unchecked") Collection<?extendsResource> result = (Collection<?extendsResource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object[] {uris});
    Preondition Violations
    Unmatched statement @SuppressWarnings("unchecked") Collection<? extends Resource> result=(Collection<? extends Resource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder,new Object[]{uris}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    @SuppressWarnings("unchecked") Collection<?extendsResource> result = (Collection<?extendsResource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object[] {uris});
    3
    @SuppressWarnings("unchecked") Collection<?extendsResource> result = (Collection<?extendsResource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object[] {targetNamespaceToURI.values()});
    3
    @SuppressWarnings("unchecked") Collection<?extendsResource> result = (Collection<?extendsResource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder, new Object[] {targetNamespaceToURI.values()});
    Preondition Violations
    Unmatched statement @SuppressWarnings("unchecked") Collection<? extends Resource> result=(Collection<? extends Resource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder,new Object[]{targetNamespaceToURI.values()}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                                                                                                                                                                                                                              
                                      
    4
    return result;
    Preondition Violations
    Unmatched return result;
    4
    return result;
    4
    return result;
    4
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    5
    return Collections.emptyList();
    5
    return Collections.emptyList();
    Precondition Violations (7)
    Row Violation
    1Type java.util.Map<java.lang.String,org.eclipse.emf.common.util.URI> of variable targetNamespaceToURI does not match with type java.util.Collection<org.eclipse.emf.common.util.URI> of variable uris
    2Unmatched statement Object ecoreBuilder=XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[]{extendedMetaData}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement Object ecoreBuilder=XSD_ECORE_BUILDER_CONSTRUCTOR.newInstance(new Object[]{extendedMetaData}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement @SuppressWarnings("unchecked") Collection<? extends Resource> result=(Collection<? extends Resource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder,new Object[]{uris}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement @SuppressWarnings("unchecked") Collection<? extends Resource> result=(Collection<? extends Resource>)XSD_ECORE_BUILDER_GENERATE_RESOURCES_METHOD.invoke(ecoreBuilder,new Object[]{targetNamespaceToURI.values()}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return result;
    7Unmatched return result;