commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Schumacher (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (LANG-456) HashCodeBuilder throws StackOverflowError in bidirectional navigable association
Date Wed, 08 Jun 2016 20:32:21 GMT

     [ https://issues.apache.org/jira/browse/LANG-456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Pascal Schumacher reopened LANG-456:
------------------------------------
      Assignee:     (was: Benedikt Ritter)

I reverted the commit because it caused LANG-1229. I believe we can not justify a major performance
regression to add this feature. The best approach would be to add a new method that appends
with the check (see discussion of LANG-1229).

> HashCodeBuilder throws StackOverflowError in bidirectional navigable association
> --------------------------------------------------------------------------------
>
>                 Key: LANG-456
>                 URL: https://issues.apache.org/jira/browse/LANG-456
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 2.4
>         Environment: Widows XP. Sun JDK 1.5 or 1.6.
>            Reporter: Bob Fields
>         Attachments: 0001-LANG-456-HashCodeBuilder-throws-StackOverflowError-i.patch,
HashCodeBuilderStackOverflow.zip, LANG-456-patch.txt, StackOverflowError.zip
>
>
> This is not the reflection methods, it is the regular HashCodeBuilder append methods.
It causes EqualsBuilder, ToStringBuilder, CompareToBuilder to also throw the StackOverflowException,
but those methods work when one of the HashCodeBuilder bidirectional association attributes
.hashCode() is commented out. The problem is that all of the builders call registerObject()
which creates a hashCode, but only the reflectionAppend method checks if an object is registered.
> Bi-directional associations are a very common pattern in Jaxb and Hibernate. In this
case, I generate code from a model in order to avoid the reflection penalty - I already know
what the attributes are at compile time, so I use .append instead of .reflectionAppend.
> See attached example + unit test. One side of the bidirectional association must be commented
out in the hashCode method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message