This sounds like a good idea to try. I would call the option something else
though. We would not skip calling equals if it is defined right? How about
"useEqualsIfPresent".

Gary

On Wed, Mar 6, 2024, 5:03 AM Mark Struberg <strub...@yahoo.de.invalid>
wrote:

> Hi!
>
> I have a question about EqualsBuilder#reflectionEquals. From Java9 onwards
> we get more and more nasty module problems. Mainly because the code tries
> to recurse into java.util.* classes as well.
> I know that I can use setBypassReflectionClasses for those. But wouldn't
> it be fine to have an additional switch to 'skipOnCustomEquals' or similar?
>
> The idea is to only use reflection on classes which do not provide their
> own equals method. One can test this imo rather easily by checking whether
> classInQuestion.getMethod("equals", Object.class).getDeclaringClass() !=
> Object.class
> Do that for lhs and rhs and if both fit the criteria -> invoke equals
>
> Wdyt of that idea? Worth trying or is there already a better solution?
> With the new flag we can make sure that we do not change the current
> behaviour for existing use cases.
>
> LieGrue,
> strub
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

Reply via email to