fromElement.setIncludeSubclasses( true ); fromElementsForLoad.add( fromElement ); //sqlResultTypeList.add( type ); // Generate the select expression. String text = fromElement.renderIdentifierSelect( size, k ); SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false ); if ( generatedExpr != null ) { generatedExpr.setFromElement( fromElement ); }
Element owner = ( Element ) target; Element existing = owner.element(elementName); if (existing!=null) existing.detach(); if (value!=null) { Element element = owner.addElement(elementName); super.propertyType.setToXMLNode(element, value, factory); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/tree/SelectClause.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/property/Dom4jAccessor.java
Method name: void initializeExplicitSelectClause(FromClause) Method name: void set(Object, Object, SessionFactoryImplementor)
Number of AST nodes: 6 Number of AST nodes: 7
1
fromElement.setIncludeSubclasses( true );
1
Element
2
							fromElementsForLoad.add( fromE
2
 owner = ( Element ) target;
3
lement );
3
				Element existing = owner.element(elementName);
4
							//sqlResultTypeList.add( type );
4
				if (existing!=null) existing.detach();
5
							// Generate the select expression.
5
				
6
							String text = fromElement.renderIdentifierSelect( size, k );
7
							SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
8
							if ( generatedExpr != null ) {
9
								generatedExpr.setFromElement( fromElement );
10
			
6
if (value!=null) {
7
					Element element = owner.addElement(elementName);
8
					super.propertyType.setToXMLNode(element, value, factory);
11
				}
9
				}
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 different classes
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                      
    2
    Element owner = (Element)target;
                                                                                                  
    3
    Element existing = owner.element(elementName);
    42
    fromElement.setIncludeSubclasses(true);
    42
    fromElement.setIncludeSubclasses(true);
    Preondition Violations
    Unmatched statement fromElement.setIncludeSubclasses(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                          
    43
    fromElementsForLoad.add(fromElement);
                                                                                      
    44
    String text = fromElement.renderIdentifierSelect(size, k);
                                                                                                                          
    45
    SelectExpressionImpl generatedExpr = (SelectExpressionImpl)appender.append(SqlTokenTypes.SELECT_EXPR, text, false);
    45
    SelectExpressionImpl generatedExpr = (SelectExpressionImpl)appender.append(SqlTokenTypes.SELECT_EXPR, text, false);
    Preondition Violations
    Unmatched statement SelectExpressionImpl generatedExpr=(SelectExpressionImpl)appender.append(SqlTokenTypes.SELECT_EXPR,text,false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                                          
    46
    if (generatedExpr != null)
    46
    if (generatedExpr != null)
    4
    if (existing != null)
    Differences
    Expression1Expression2Difference
    generatedExprexistingVARIABLE_NAME_MISMATCH
    org.hibernate.hql.ast.tree.SelectExpressionImplorg.dom4j.ElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.hql.ast.tree.SelectExpressionImpl of variable generatedExpr does not match with type org.dom4j.Element of variable existing
    • Make classes org.hibernate.hql.ast.tree.SelectExpressionImpl and org.dom4j.Element extend a common superclass
    4
    if (existing != null)
                                              
    5
    existing.detach();
    Preondition Violations
    Unmatched statement existing.detach(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    existing.detach();
    47
    generatedExpr.setFromElement(fromElement);
    47
    generatedExpr.setFromElement(fromElement);
    Preondition Violations
    Unmatched statement generatedExpr.setFromElement(fromElement); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                
    Precondition Violations (6)
    Row Violation
    1Unmatched statement fromElement.setIncludeSubclasses(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement SelectExpressionImpl generatedExpr=(SelectExpressionImpl)appender.append(SqlTokenTypes.SELECT_EXPR,text,false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.hibernate.hql.ast.tree.SelectExpressionImpl of variable generatedExpr does not match with type org.dom4j.Element of variable existing
    4Unmatched statement existing.detach(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement generatedExpr.setFromElement(fromElement); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero