this.xmlResource = resource; init(resource, options); @SuppressWarnings("unchecked") List<? extends EObject> contents = roots = (List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS); if (contents == null) { contents = resource.getContents(); } traverse(contents);
this.xmlResource = resource; init(resource, options); @SuppressWarnings("unchecked") List<? extends EObject> contents = roots = (List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS); if (contents == null) { contents = resource.getContents(); } traverse(contents);
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java
Method name: Document save(XMLResource, Document, Map, DOMHandler) Method name: void save(XMLResource, Writer, Map)
Number of AST nodes: 6 Number of AST nodes: 6
1
this.xmlResource = resource;
1
this.xmlResource = resource;
2
    
3
    init(resource, options);
2
    init(resource, options);
4
    @SuppressWarnings("unchecked")
3
    @SuppressWarnings("unchecked")
5
    List<? extends EObject> contents = roots = (List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS);
4
    List<? extends EObject> contents = roots = (List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS);
6
    if (contents == null)
5
    if (contents == null)
7
    {
6
    {
8
      contents = resource.getContents();
7
      contents = resource.getContents();
9
    }
8
    }
10
    traverse(contents);
9
    traverse(contents);
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.1
Clones locationClones are declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)312.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    this.xmlResource = resource;
    1
    this.xmlResource = resource;
    5
    init(resource, options);
    5
    init(resource, options);
    2
    init(resource, options);
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    2
    init(resource, options);
                                                                                                                                                                                                                                                                                                  
    3
    @SuppressWarnings("unchecked") List<?extendsEObject> contents = roots = (List<?extendsEObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS);
    Preondition Violations
    Unmatched statement @SuppressWarnings("unchecked") List<? extends EObject> contents=roots=(List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    @SuppressWarnings("unchecked") List<?extendsEObject> contents = roots = (List<?extendsEObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS);
    6
    @SuppressWarnings("unchecked") List<?extendsEObject> contents = roots = (List<?extendsEObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS);
    6
    @SuppressWarnings("unchecked") List<?extendsEObject> contents = roots = (List<?extendsEObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS);
    Preondition Violations
    Unmatched statement @SuppressWarnings("unchecked") List<? extends EObject> contents=roots=(List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                                                                                                  
    7
    if (contents == null)
    7
    if (contents == null)
    4
    if (contents == null)
    Differences
    Expression1Expression2Difference
    java.util.List<>java.util.List<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List<> of variable contents does not match with type java.util.List<> of variable contents
    • Make classes java.util.List<> and java.util.List<> extend a common superclass
    4
    if (contents == null)
    8
    contents = resource.getContents();
    5
    contents = resource.getContents();
    9
    traverse(contents);
    9
    traverse(contents);
    6
    traverse(contents);
    Differences
    Expression1Expression2Difference
    java.util.List<>java.util.List<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List<> of variable contents does not match with type java.util.List<> of variable contents
    • Make classes java.util.List<> and java.util.List<> extend a common superclass
    6
    traverse(contents);
    Precondition Violations (5)
    Row Violation
    1Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    2Unmatched statement @SuppressWarnings("unchecked") List<? extends EObject> contents=roots=(List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement @SuppressWarnings("unchecked") List<? extends EObject> contents=roots=(List<? extends EObject>)options.get(XMLResource.OPTION_ROOT_OBJECTS); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type java.util.List<> of variable contents does not match with type java.util.List<> of variable contents
    5Type java.util.List<> of variable contents does not match with type java.util.List<> of variable contents