alhudz opened a new pull request, #1747: URL: https://github.com/apache/commons-lang/pull/1747
Repro: `new HashCodeBuilder(17, 37).append((Object) x).toHashCode()` where `x.hashCode()` is `HashCodeBuilder.reflectionHashCode(x)` returns `17 * 37 + 17` instead of `17 * 37 + x.hashCode()`. The same collapse hits an ordinary acyclic graph: `reflectionHashCode(holder)` drops the content of any field whose own `hashCode()` is reflection based, so two holders differing only in such a field share a hash while `reflectionEquals` reports them unequal. Cause: the cycle guard added in #1650 has `append(Object)` call `register(object)` on the same `REGISTRY` that `reflectionAppend` consults, so `x`'s reflective `hashCode()` finds `x` already registered, mistakes it for a cycle and returns the bare initial value. Fix: `append(Object)` keeps a separate append registry for its re-entrancy guard and still checks `REGISTRY`, so reflection cycles (including the mutually referential `testReflectionObjectCycle`) behave exactly as before. Added `testAppendObjectReflectionHashCodeNotPoisoned`; it fails before (expected `1300`, was `646`) and passes after. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
