PersistentClass pc = (PersistentClass) iter.next(); if ( !pc.isInherited() ) { IdentifierGenerator ig = pc.getIdentifier() .createIdentifierGenerator( dialect, defaultCatalog, defaultSchema, (RootClass) pc ); if ( ig instanceof PersistentIdentifierGenerator ) { generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig ); } }
Collection collection = (Collection) iter.next(); if ( collection.isIdentified() ) { IdentifierGenerator ig = ( (IdentifierCollection) collection ).getIdentifier() .createIdentifierGenerator( dialect, defaultCatalog, defaultSchema, null ); if ( ig instanceof PersistentIdentifierGenerator ) { generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java
Method name: Iterator iterateGenerators(Dialect) Method name: Iterator iterateGenerators(Dialect)
Number of AST nodes: 5 Number of AST nodes: 5
1
PersistentClass pc = (PersistentClass) iter.next();
1
Collection collection = (Collection) iter.next();
2
			if ( !pc.isInherited() ) {
2
			if ( collection.isIdentified() ) {
3
				IdentifierGenerator ig = pc.getIdentifier()
3
				IdentifierGenerator ig = ( (IdentifierCollection) collection ).getIdentifier()
4
						.createIdentifierGenerator(
4
						.createIdentifierGenerator(
5
								dialect,
5
								dialect,
6
								defaultCatalog,
6
								defaultCatalog,
7
								defaultSchema,
7
								defaultSchema,
8
								(RootClass) pc
8
								null
9
							);
9
							);
10
				if ( ig instanceof PersistentIdentifierGenerator ) {
10
				if ( ig instanceof PersistentIdentifierGenerator ) {
11
					generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
11
					generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
12
				}
12
				}
13
			}
13
			}
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.3
Clones locationClones are in the same method
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)33.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    PersistentClass pc = (PersistentClass)iter.next();
    6
    PersistentClass pc = (PersistentClass)iter.next();
    Preondition Violations
    Unmatched statement PersistentClass pc=(PersistentClass)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
                                                                                                        
    13
    Collection collection = (Collection)iter.next();
    Preondition Violations
    Unmatched statement Collection collection=(Collection)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    Collection collection = (Collection)iter.next();
    7
    if (!pc.isInherited())
    7
    if (!pc.isInherited())
    14
    if (collection.isIdentified())
    Differences
    Expression1Expression2Difference
    !pc.isInherited()collection.isIdentified()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !pc.isInherited() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression collection.isIdentified() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (collection.isIdentified())
    8
    IdentifierGenerator ig = pc.getIdentifier().createIdentifierGenerator(dialect, defaultCatalog, defaultSchema, (RootClass)pc);
    8
    IdentifierGenerator ig = pc.getIdentifier().createIdentifierGenerator(dialect, defaultCatalog, defaultSchema, (RootClass)pc);
    Preondition Violations
    Unmatched statement IdentifierGenerator ig=pc.getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,(RootClass)pc); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement IdentifierGenerator ig=pc.getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,(RootClass)pc); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          
    15
    IdentifierGenerator ig = ((IdentifierCollection)collection).getIdentifier().createIdentifierGenerator(dialect, defaultCatalog, defaultSchema, null);
    Preondition Violations
    Unmatched statement IdentifierGenerator ig=((IdentifierCollection)collection).getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement IdentifierGenerator ig=((IdentifierCollection)collection).getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    15
    IdentifierGenerator ig = ((IdentifierCollection)collection).getIdentifier().createIdentifierGenerator(dialect, defaultCatalog, defaultSchema, null);
    9
    if (ig instanceof PersistentIdentifierGenerator)
    16
    if (ig instanceof PersistentIdentifierGenerator)
    10
    generators.put(((PersistentIdentifierGenerator)ig).generatorKey(), ig);
    17
    generators.put(((PersistentIdentifierGenerator)ig).generatorKey(), ig);
    Precondition Violations (8)
    Row Violation
    1Unmatched statement PersistentClass pc=(PersistentClass)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Collection collection=(Collection)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression !pc.isInherited() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression collection.isIdentified() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement IdentifierGenerator ig=pc.getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,(RootClass)pc); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement IdentifierGenerator ig=pc.getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,(RootClass)pc); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7Unmatched statement IdentifierGenerator ig=((IdentifierCollection)collection).getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement IdentifierGenerator ig=((IdentifierCollection)collection).getIdentifier().createIdentifierGenerator(dialect,defaultCatalog,defaultSchema,null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted