Hi Mark,

On 9.12.2024 17:37, Mark Struberg wrote:
c) try using this on a class which contains e.g. an ArrayList, a Set or a Map. 
It will e.g. use List#equals() which also does equals() on it's items (btw, I 
explained this to you already...). Which is NOT what users expect. Instead it 
should iterate over the List and use ReflectionEquals on the elements. This is 
exactly what the PR does (amongst other things).

Why would a user expect to use `reflectionEquals` on the elements of an internal list field?

IMHO, if you run `reflectionEquals` on two objects of type A:

* the caller must ensure that the fields of A are accessible. This requirement didn't change: previously the caller had to set the appropriate `SecurityManager` permissions, now he needs to set the appropriate JPMS permissions.

* internal fields that are NOT of type A or Collection<A>, should be compared using `equals()`.

* internal fields that are of type A or Collection<A>, can be compared using `reflectionEquals` if the users requests it.

Piotr


Reply via email to