Index index = (Index) indexes.get( indexName ); if ( index == null ) { index = new Index(); index.setName( indexName ); index.setTable( this ); indexes.put( indexName, index ); } return index;
UniqueKey uk = (UniqueKey) uniqueKeys.get( keyName ); if ( uk == null ) { uk = new UniqueKey(); uk.setName( keyName ); uk.setTable( this ); uniqueKeys.put( keyName, uk ); } return uk;
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: Index getOrCreateIndex(String) Method name: UniqueKey getOrCreateUniqueKey(String)
Number of AST nodes: 7 Number of AST nodes: 7
1
Index index = (Index) indexes.get( indexName );
1
UniqueKey uk = (UniqueKey) uniqueKeys.get( keyName );
2
		if ( index == null ) {
2
		if ( uk == null ) {
3
			index = new Index();
3
			uk = new UniqueKey();
4
			index.setName( indexName );
4
			uk.setName( keyName );
5
			index.setTable( this );
5
			uk.setTable( this );
6
			indexes.put( indexName, index );
6
			uniqueKeys.put( keyName, uk );
7
		}
7
		}
8
		return index;
8
		return uk;
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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                          
    1
    UniqueKey uk = (UniqueKey)uniqueKeys.get(keyName);
    1
    Index index = (Index)indexes.get(indexName);
                                                                                              
    2
    if (index == null)
    2
    if (index == null)
    2
    if (uk == null)
    Differences
    Expression1Expression2Difference
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    • Make classes org.hibernate.mapping.Index and org.hibernate.mapping.UniqueKey extend a common superclass
    2
    if (uk == null)
                                                
    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
    3
    uk = new UniqueKey();
    3
    index = new Index();
    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
                                              
    4
    index.setName(indexName);
    4
    index.setName(indexName);
    4
    uk.setName(keyName);
    Differences
    Expression1Expression2Difference
    indexNamekeyNameVARIABLE_NAME_MISMATCH
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    • Make classes org.hibernate.mapping.Index and org.hibernate.mapping.UniqueKey extend a common superclass
    4
    uk.setName(keyName);
    5
    index.setTable(this);
    5
    index.setTable(this);
    5
    uk.setTable(this);
    Differences
    Expression1Expression2Difference
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    • Make classes org.hibernate.mapping.Index and org.hibernate.mapping.UniqueKey extend a common superclass
    5
    uk.setTable(this);
    6
    indexes.put(indexName, index);
    6
    indexes.put(indexName, index);
    6
    uniqueKeys.put(keyName, uk);
    Differences
    Expression1Expression2Difference
    indexNamekeyNameVARIABLE_NAME_MISMATCH
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeyVARIABLE_TYPE_MISMATCH
    indexesuniqueKeysVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    • Make classes org.hibernate.mapping.Index and org.hibernate.mapping.UniqueKey extend a common superclass
    6
    uniqueKeys.put(keyName, uk);
                              
    7
    return uk;
    Preondition Violations
    Unmatched return uk;
    7
    return uk;
    7
    return index;
    7
    return index;
    Preondition Violations
    Unmatched return index;
                                    
    Precondition Violations (8)
    Row Violation
    1Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    2Unmatched statement uk=new UniqueKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement index=new Index(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    5Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    6Type org.hibernate.mapping.Index of variable index does not match with type org.hibernate.mapping.UniqueKey of variable uk
    7Unmatched return uk;
    8Unmatched return index;