Method equals; try { equals = extractEqualsMethod( clazz ); } catch ( NoSuchMethodException nsme ) { return false; //its an interface so we can't really tell anything... } return !OBJECT_EQUALS.equals( equals );
Method hashCode; try { hashCode = extractHashCodeMethod( clazz ); } catch ( NoSuchMethodException nsme ) { return false; //its an interface so we can't really tell anything... } return !OBJECT_HASHCODE.equals( hashCode );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ReflectHelper.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ReflectHelper.java
Method name: boolean overridesEquals(Class) Method name: boolean overridesHashCode(Class)
Number of AST nodes: 4 Number of AST nodes: 4
1
Method equals;
1
Method hashCode;
2
		try {
2
		try {
3
			equals = extractEqualsMethod( clazz );
3
			hashCode = extractHashCodeMethod( clazz );
4
		}
4
		}
5
		catch ( NoSuchMethodException nsme ) {
5
		catch ( NoSuchMethodException nsme ) {
6
			return false; //its an interface so we can't really tell anything...
6
			return false; //its an interface so we can't really tell anything...
7
		}
7
		}
8
		return !OBJECT_EQUALS.equals( equals );
8
		return !OBJECT_HASHCODE.equals( hashCode );
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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Method equals;
    1
    Method equals;
    1
    Method hashCode;
    Differences
    Expression1Expression2Difference
    equalshashCodeVARIABLE_NAME_MISMATCH
    1
    Method hashCode;
    2
    try
    2
    try
    3
    equals = extractEqualsMethod(clazz);
    3
    equals = extractEqualsMethod(clazz);
    3
    hashCode = extractHashCodeMethod(clazz);
    Differences
    Expression1Expression2Difference
    equalshashCodeVARIABLE_NAME_MISMATCH
    extractEqualsMethodextractHashCodeMethodMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression extractEqualsMethod(clazz) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression extractHashCodeMethod(clazz) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3
    hashCode = extractHashCodeMethod(clazz);
    4
    return !OBJECT_EQUALS.equals(equals);
    4
    return !OBJECT_EQUALS.equals(equals);
    4
    return !OBJECT_HASHCODE.equals(hashCode);
    Differences
    Expression1Expression2Difference
    equalshashCodeVARIABLE_NAME_MISMATCH
    OBJECT_EQUALSOBJECT_HASHCODEVARIABLE_NAME_MISMATCH
    4
    return !OBJECT_HASHCODE.equals(hashCode);
    Precondition Violations (2)
    Row Violation
    1Expression extractEqualsMethod(clazz) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression extractHashCodeMethod(clazz) is a method call throwing exception(s) that should be caught by a try block that will be extracted