NamedParameterDescription desc = ( NamedParameterDescription ) namedParameterDescriptions.get( name ); if ( desc == null ) { desc = new NamedParameterDescription( jpa ); namedParameterDescriptions.put( name, desc ); } return desc;
EntityStatistics es = (EntityStatistics) entityStatistics.get(entityName); if (es==null) { es = new EntityStatistics(entityName); entityStatistics.put(entityName, es); } return es;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/query/ParamLocationRecognizer.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/stat/StatisticsImpl.java
Method name: NamedParameterDescription getOrBuildNamedParameterDescription(String, boolean) Method name: EntityStatistics getEntityStatistics(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
NamedParameterDescription desc = ( NamedParameterDescription ) namedParameterDescriptions.get( name );
1
EntityStatistics es = (EntityStatistics) entityStatistics.get(entityName);
2
		if ( desc == null ) {
2
		if (es==null) {
3
			desc = new NamedParameterDescription( jpa );
3
			es = new 
4
			namedParameterDescriptions.put( n
4
EntityStatistics(entityName);
5
ame, desc );
5
			entityStatistics.put(entityName, es);
6
		}
6
		}
7
		return desc;
7
		return es;
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                        
    1
    EntityStatistics es = (EntityStatistics)entityStatistics.get(entityName);
    1
    NamedParameterDescription desc = (NamedParameterDescription)namedParameterDescriptions.get(name);
                                                                                                                                                                                                        
    2
    if (desc == null)
    2
    if (desc == null)
    2
    if (es == null)
    Differences
    Expression1Expression2Difference
    descesVARIABLE_NAME_MISMATCH
    org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescriptionorg.hibernate.stat.EntityStatisticsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription of variable desc does not match with type org.hibernate.stat.EntityStatistics of variable es
    • Make classes org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription and org.hibernate.stat.EntityStatistics extend a common superclass
    2
    if (es == null)
                                                                                  
    3
    es = new EntityStatistics(entityName);
    Preondition Violations
    Unmatched statement es=new EntityStatistics(entityName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    es = new EntityStatistics(entityName);
    3
    desc = new NamedParameterDescription(jpa);
    3
    desc = new NamedParameterDescription(jpa);
    Preondition Violations
    Unmatched statement desc=new NamedParameterDescription(jpa); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                          
    4
    namedParameterDescriptions.put(name, desc);
    4
    namedParameterDescriptions.put(name, desc);
    4
    entityStatistics.put(entityName, es);
    Differences
    Expression1Expression2Difference
    nameentityNameVARIABLE_NAME_MISMATCH
    descesVARIABLE_NAME_MISMATCH
    org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescriptionorg.hibernate.stat.EntityStatisticsVARIABLE_TYPE_MISMATCH
    namedParameterDescriptionsentityStatisticsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription of variable desc does not match with type org.hibernate.stat.EntityStatistics of variable es
    • Make classes org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription and org.hibernate.stat.EntityStatistics extend a common superclass
    4
    entityStatistics.put(entityName, es);
                              
    5
    return es;
    Preondition Violations
    Unmatched return es;
    5
    return es;
    5
    return desc;
    5
    return desc;
    Preondition Violations
    Unmatched return desc;
                                  
    Precondition Violations (7)
    Row Violation
    1Type org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription of variable desc does not match with type org.hibernate.stat.EntityStatistics of variable es
    2Unmatched statement es=new EntityStatistics(entityName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement desc=new NamedParameterDescription(jpa); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription of variable desc does not match with type org.hibernate.stat.EntityStatistics of variable es
    5Unmatched return es;
    6Unmatched return desc;
    7The refactoring of the clones is infeasible, because classes org.hibernate.engine.query.ParamLocationRecognizer and org.hibernate.stat.StatisticsImpl do not have a common superclass