if ( querySpaces == null ) { querySpaces = new ArrayList(); } querySpaces.add( querySpace ); return this;
if ( synchronizations == null ) { synchronizations = new LinkedList(); } synchronizations.add( synchronization );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SQLQueryImpl.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/util/DualNodeJtaTransactionImpl.java
Method name: SQLQuery addSynchronizedQuerySpace(String) Method name: void registerSynchronization(Synchronization)
Number of AST nodes: 4 Number of AST nodes: 3
1
if ( querySpaces == null ) {
1
if ( synchronizations == null ) {
2
			querySpaces = new ArrayList();
2
			synchronizations = new LinkedList();
3
		}
3
		}
4
		querySpaces.add( querySpace );
4
		
5
		return this;
5
synchronizations.add( synchronization );
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 in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (querySpaces == null)
    1
    if (querySpaces == null)
    1
    if (synchronizations == null)
    Differences
    Expression1Expression2Difference
    querySpacessynchronizationsVARIABLE_NAME_MISMATCH
    java.util.Collectionjava.util.LinkedListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection of variable querySpaces does not match with type java.util.LinkedList of variable synchronizations
    • Make classes java.util.Collection and java.util.LinkedList extend a common superclass
    1
    if (synchronizations == null)
                                                                              
    2
    synchronizations = new LinkedList();
    Preondition Violations
    Unmatched statement synchronizations=new LinkedList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    synchronizations = new LinkedList();
    2
    querySpaces = new ArrayList();
    2
    querySpaces = new ArrayList();
    Preondition Violations
    Unmatched statement querySpaces=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    3
    querySpaces.add(querySpace);
    3
    querySpaces.add(querySpace);
    3
    synchronizations.add(synchronization);
    Differences
    Expression1Expression2Difference
    querySpacesynchronizationVARIABLE_NAME_MISMATCH
    java.lang.Stringjavax.transaction.SynchronizationVARIABLE_TYPE_MISMATCH
    querySpacessynchronizationsVARIABLE_NAME_MISMATCH
    java.util.Collectionjava.util.LinkedListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable querySpace does not match with type javax.transaction.Synchronization of variable synchronization
    • Make classes java.lang.String and javax.transaction.Synchronization extend a common superclass
    Type java.util.Collection of variable querySpaces does not match with type java.util.LinkedList of variable synchronizations
    • Make classes java.util.Collection and java.util.LinkedList extend a common superclass
    3
    synchronizations.add(synchronization);
    4
    return this;
    4
    return this;
    Preondition Violations
    Unmatched return this;
                                  
    Precondition Violations (6)
    Row Violation
    1Type java.util.Collection of variable querySpaces does not match with type java.util.LinkedList of variable synchronizations
    2Unmatched statement synchronizations=new LinkedList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement querySpaces=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable querySpace does not match with type javax.transaction.Synchronization of variable synchronization
    5Type java.util.Collection of variable querySpaces does not match with type java.util.LinkedList of variable synchronizations
    6Unmatched return this;