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.2
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.9
    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 org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder does not match with type org.hibernate.test.sql.hand.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;
                                                                                                                      
    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
    Expression pk.lastName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression monetaryAmount.currency cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable pk.lastName does not match with type java.util.Currency of variable monetaryAmount.currency
    • Make classes org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder and org.hibernate.test.sql.hand.MonetaryAmount extend a common superclass
    Expression pk.lastName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression monetaryAmount.currency cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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;
    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
    Expression pk.ssn cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression monetaryAmount.value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable pk.ssn does not match with type java.math.BigDecimal of variable monetaryAmount.value
    • Make classes org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder and org.hibernate.test.sql.hand.MonetaryAmount extend a common superclass
    Expression pk.ssn cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression monetaryAmount.value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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;
    Precondition Violations (16)
    Row Violation
    1Type org.hibernate.test.cache.jbc2.functional.classloader.AccountHolder does not match with type org.hibernate.test.sql.hand.MonetaryAmount
    2Expression pk.lastName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression monetaryAmount.currency cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable pk.lastName does not match with type java.util.Currency of variable monetaryAmount.currency
    5Expression pk.lastName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression monetaryAmount.currency cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.lang.String of variable pk.lastName does not match with type java.util.Currency of variable monetaryAmount.currency
    8Type java.lang.String of variable lastName does not match with type java.util.Currency of variable currency
    9Expression pk.ssn cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression monetaryAmount.value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type java.lang.String of variable pk.ssn does not match with type java.math.BigDecimal of variable monetaryAmount.value
    12Expression pk.ssn cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression monetaryAmount.value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Type java.lang.String of variable pk.ssn does not match with type java.math.BigDecimal of variable monetaryAmount.value
    15Type java.lang.String of variable ssn does not match with type java.math.BigDecimal of variable value
    16Not all possible execution flows end in a return statement