if (obj == this) return true; if (!(obj instanceof AccountHolder)) return false; AccountHolder pk = (AccountHolder)obj; if (!lastName.equals(pk.lastName)) return false; if (!ssn.equals(pk.ssn)) return false; return true;
if (this == o) return true; if (!(o instanceof MonetaryAmount)) return false; final MonetaryAmount monetaryAmount = (MonetaryAmount) o; if (!currency.equals(monetaryAmount.currency)) return false; if (!value.equals(monetaryAmount.value)) return false; return true;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/AccountHolder.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/sql/hand/MonetaryAmount.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (obj == this) return true;
1
if (this == o) return true;
2
      
3
if (!(obj instanceof AccountHolder)) return false;
2
		if (!(o instanceof MonetaryAmount)) return false;
4
      AccountHolder pk = (AccountHolder)obj;
5
      if (!lastName.equals(pk.lastName)) return false;
6
      if (!ssn.equals(pk.ssn
3
		final MonetaryAmount monetaryAmount = (MonetaryAmount) o;
4
		if (!currency.equals(monetaryAmount.currency)) return false;
7
)) return false;
5
		if (!value.equals(monetaryAmount.value)) return false;
8
      
9
return true;
6
		return true;
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)1.0
Clones locationClones are in different classes
Number of node comparisons35
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (!(obj instanceof AccountHolder))
    3
    if (!(obj instanceof AccountHolder))
    3
    if (!(o instanceof MonetaryAmount))
    Differences
    Expression1Expression2Difference
    objoVARIABLE_NAME_MISMATCH
    org.hibernate.test.cache.jbc2.functional.classloader.AccountHolderorg.hibernate.test.sql.hand.MonetaryAmountVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type boolean of variable obj instanceof AccountHolder does not match with type boolean of variable o instanceof MonetaryAmount
    • Make classes org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder and org.hibernate.test.sql.hand.MonetaryAmount extend a common superclass
    3
    if (!(o instanceof MonetaryAmount))
    4
    return false;
    4
    return false;
    4
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    4
    return false;
                                                                                                                      
    5
    final MonetaryAmount monetaryAmount = (MonetaryAmount)o;
    5
    AccountHolder pk = (AccountHolder)obj;
                                                                                  
    6
    if (!lastName.equals(pk.lastName))
    6
    if (!lastName.equals(pk.lastName))
    6
    if (!currency.equals(monetaryAmount.currency))
    Differences
    Expression1Expression2Difference
    pkmonetaryAmountVARIABLE_NAME_MISMATCH
    org.hibernate.test.cache.jbc2.functional.classloader.AccountHolderorg.hibernate.test.sql.hand.MonetaryAmountVARIABLE_TYPE_MISMATCH
    lastNamecurrencyVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.util.CurrencyVARIABLE_TYPE_MISMATCH
    lastNamecurrencyVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.util.CurrencyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder of variable pk does not match with type org.hibernate.test.sql.hand.MonetaryAmount of variable monetaryAmount
    • Make classes org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder and org.hibernate.test.sql.hand.MonetaryAmount extend a common superclass
    Type java.lang.String of variable pk.lastName does not match with type java.util.Currency of variable monetaryAmount.currency
    • Make classes java.lang.String and java.util.Currency extend a common superclass
    Type java.lang.String of variable lastName does not match with type java.util.Currency of variable currency
    • Make classes java.lang.String and java.util.Currency extend a common superclass
    6
    if (!currency.equals(monetaryAmount.currency))
    7
    return false;
    7
    return false;
    7
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    7
    return false;
    8
    if (!ssn.equals(pk.ssn))
    8
    if (!ssn.equals(pk.ssn))
    8
    if (!value.equals(monetaryAmount.value))
    Differences
    Expression1Expression2Difference
    pkmonetaryAmountVARIABLE_NAME_MISMATCH
    org.hibernate.test.cache.jbc2.functional.classloader.AccountHolderorg.hibernate.test.sql.hand.MonetaryAmountVARIABLE_TYPE_MISMATCH
    ssnvalueVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.math.BigDecimalVARIABLE_TYPE_MISMATCH
    ssnvalueVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.math.BigDecimalVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder of variable pk does not match with type org.hibernate.test.sql.hand.MonetaryAmount of variable monetaryAmount
    • Make classes org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder and org.hibernate.test.sql.hand.MonetaryAmount extend a common superclass
    Type java.lang.String of variable pk.ssn does not match with type java.math.BigDecimal of variable monetaryAmount.value
    • Make classes java.lang.String and java.math.BigDecimal extend a common superclass
    Type java.lang.String of variable ssn does not match with type java.math.BigDecimal of variable value
    • Make classes java.lang.String and java.math.BigDecimal extend a common superclass
    8
    if (!value.equals(monetaryAmount.value))
    9
    return false;
    9
    return false;
    9
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    9
    return false;
    Precondition Violations (13)
    Row Violation
    1Type boolean of variable obj instanceof AccountHolder does not match with type boolean of variable o instanceof MonetaryAmount
    2Type org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder of variable pk does not match with type org.hibernate.test.sql.hand.MonetaryAmount of variable monetaryAmount
    3Type java.lang.String of variable pk.lastName does not match with type java.util.Currency of variable monetaryAmount.currency
    4Type java.lang.String of variable lastName does not match with type java.util.Currency of variable currency
    5Type org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder of variable pk does not match with type org.hibernate.test.sql.hand.MonetaryAmount of variable monetaryAmount
    6Type java.lang.String of variable pk.ssn does not match with type java.math.BigDecimal of variable monetaryAmount.value
    7Type java.lang.String of variable ssn does not match with type java.math.BigDecimal of variable value
    8Conditional return false;
    9Conditional return false;
    10Conditional return false;
    11Conditional return false;
    12Conditional return false;
    13Conditional return false;