UniqueKey uk = (UniqueKey) uniqueKeys.get( keyName ); if ( uk == null ) { uk = new UniqueKey(); uk.setName( keyName ); uk.setTable( this ); uniqueKeys.put( keyName, uk ); } return uk;
Index index = (Index) indexes.get( indexName ); if ( index == null ) { index = new Index(); index.setName( indexName ); index.setTable( this ); indexes.put( indexName, index ); } return index;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Table.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Table.java
Method name: UniqueKey getOrCreateUniqueKey(String) Method name: Index getOrCreateIndex(String)
Number of AST nodes: 7 Number of AST nodes: 7
1
UniqueKey uk = (UniqueKey) uniqueKeys.get( keyName );
1
Index index = (Index) indexes.get( indexName );
2
		if ( uk == null ) {
2
		if ( index == null ) {
3
			uk = new UniqueKey();
3
			index = new Index();
4
			uk.setName( keyName );
4
			index.setName( indexName );
5
			uk.setTable( this );
5
			index.setTable( this );
6
			uniqueKeys.put( keyName, uk );
6
			indexes.put( indexName, index );
7
		}
7
		}
8
		return uk;
8
		return index;
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 comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                              
    1
    Index index = (Index)indexes.get(indexName);
    1
    UniqueKey uk = (UniqueKey)uniqueKeys.get(keyName);
                                                                                                          
    2
    if (uk == null)
    2
    if (uk == null)
    2
    if (index == null)
    Differences
    Expression1Expression2Difference
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    2
    if (index == null)
                                              
    3
    index = new Index();
    Preondition Violations
    Unmatched statement index=new Index(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    index = new Index();
    3
    uk = new UniqueKey();
    3
    uk = new UniqueKey();
    Preondition Violations
    Unmatched statement uk=new UniqueKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
    4
    uk.setName(keyName);
    4
    uk.setName(keyName);
    4
    index.setName(indexName);
    Differences
    Expression1Expression2Difference
    keyNameindexNameVARIABLE_NAME_MISMATCH
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    4
    index.setName(indexName);
    5
    uk.setTable(this);
    5
    uk.setTable(this);
    5
    index.setTable(this);
    Differences
    Expression1Expression2Difference
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    5
    index.setTable(this);
    6
    uniqueKeys.put(keyName, uk);
    6
    uniqueKeys.put(keyName, uk);
    6
    indexes.put(indexName, index);
    Differences
    Expression1Expression2Difference
    keyNameindexNameVARIABLE_NAME_MISMATCH
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    uniqueKeysindexesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    6
    indexes.put(indexName, index);
                                    
    7
    return index;
    Preondition Violations
    Unmatched return index;
    7
    return index;
    7
    return uk;
    7
    return uk;
    Preondition Violations
    Unmatched return uk;
                              
    Precondition Violations (8)
    Row Violation
    1Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    2Unmatched statement index=new Index(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement uk=new UniqueKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    5Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    6Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    7Unmatched return index;
    8Unmatched return uk;