if (typeName.equals("F")) { // float code.addOpcode(Opcode.FRETURN); } else if (typeName.equals("J")) { // long code.addOpcode(Opcode.LRETURN); } else { // bad type throw new RuntimeException("bad type: " + typeName); }
if ( propertyName.equals(CollectionPropertyNames.COLLECTION_MAX_ELEMENT) ) { return memberPersister.getElementType(); } else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_MIN_ELEMENT) ) { return memberPersister.getElementType(); } else { //return memberPersister.getPropertyType(propertyName); throw new QueryException("illegal syntax near collection: " + propertyName); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/FieldTransformer.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/CollectionPropertyMapping.java
Method name: void addTypeDependDataReturn(Bytecode, String) Method name: Type toType(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (typeName.equals("F")) {
1
if ( propertyName.equals(
2
			// float
3
			code.addOpcode(Opcode.FRETURN
2
CollectionPropertyNames.COLLECTION_MAX_ELEMENT) ) {
4
);
3
			return memberPersister.getElementType();
5
		} 
4
		}
6
else if (typeName.equals("J")) {
5
		else if ( propertyName.equals(
7
			// long
8
			code.addOpcode(Opcode.LRETURN
6
CollectionPropertyNames.COLLECTION_MIN_ELEMENT) ) {
9
);
7
			return memberPersister.getElementType();
10
		} 
8
		}
11
else {
9
		else {
12
			// bad type
10
			//return memberPersister.getPropertyType(propertyName);
13
			throw new RuntimeException("bad type: " + typeName);
11
			throw new QueryException("illegal syntax near collection: " + propertyName);
14
		}
12
		}
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.4
Clones locationClones are in different classes
Number of node comparisons20
  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)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    else if (typeName.equals("F"))
    7
    else if (typeName.equals("F"))
    13
    else if (propertyName.equals(CollectionPropertyNames.COLLECTION_MAX_ELEMENT))
    Differences
    Expression1Expression2Difference
    "F"CollectionPropertyNames.COLLECTION_MAX_ELEMENTTYPE_COMPATIBLE_REPLACEMENT
    typeNamepropertyNameVARIABLE_NAME_MISMATCH
    13
    else if (propertyName.equals(CollectionPropertyNames.COLLECTION_MAX_ELEMENT))
    8
    code.addOpcode(Opcode.FRETURN);
                                                                        
                                                                                            
    14
    return memberPersister.getElementType();
    Preondition Violations
    Unmatched return memberPersister.getElementType();
    14
    return memberPersister.getElementType();
    9
    else if (typeName.equals("J"))
    9
    else if (typeName.equals("J"))
    15
    else if (propertyName.equals(CollectionPropertyNames.COLLECTION_MIN_ELEMENT))
    Differences
    Expression1Expression2Difference
    "J"CollectionPropertyNames.COLLECTION_MIN_ELEMENTTYPE_COMPATIBLE_REPLACEMENT
    typeNamepropertyNameVARIABLE_NAME_MISMATCH
    15
    else if (propertyName.equals(CollectionPropertyNames.COLLECTION_MIN_ELEMENT))
    10
    code.addOpcode(Opcode.LRETURN);
                                                                          
                                                                                            
    16
    return memberPersister.getElementType();
    Preondition Violations
    Unmatched return memberPersister.getElementType();
    16
    return memberPersister.getElementType();
    else
    else
    11
    throw new RuntimeException("bad type: " + typeName);
    11
    throw new RuntimeException("bad type: " + typeName);
    17
    throw new QueryException("illegal syntax near collection: " + propertyName);
    Differences
    Expression1Expression2Difference
    java.lang.RuntimeExceptionorg.hibernate.QueryExceptionSUBCLASS_TYPE_MISMATCH
    "bad type: ""illegal syntax near collection: "LITERAL_VALUE_MISMATCH
    typeNamepropertyNameVARIABLE_NAME_MISMATCH
    17
    throw new QueryException("illegal syntax near collection: " + propertyName);
    Precondition Violations (2)
    Row Violation
    1Unmatched return memberPersister.getElementType();
    2Unmatched return memberPersister.getElementType();