Hi Paul, do you have an example where ERXEOControlUtilities.validateUniquenessOf() does not work because of ERXArrayUtilities.arrayMinusObject()? What is the exact error?
I did a quick test in my code and could not see wrong outcome. Looking at the
code change before that commit:
public static <T> NSArray<T> arrayMinusObject(NSArray<T> main, Object object) {
NSMutableArray<T> mutable = new NSMutableArray<T>(main);
mutable.removeObject(object);
return mutable.immutableClone();
}
and after:
public static <T> NSArray<T> arrayMinusObject(Collection<T> array, T object) {
if (object == null) {
return new NSArray<T>(array);
}
NSMutableArray<T> result = new NSMutableArray<>(array);
result.remove(object);
return result.immutableClone();
}
I doubt that object is not removed from the array, the only reason that comes
to my mind would be that the editing context of object and that of the array
are different so that equals() would return false but
ERXEOControlUtilities.validateUniquenessOf() uses the same editing context for
both params. Perhaps some other part is the cause of your problem?
jw
> Am 15.04.2016 um 14:24 schrieb Paul Hoadley <[email protected]>:
>
> Hi Johann,
>
> In 1d56e6d6, you changed the API for these methods—I assume "use interfaces
> as params where possible” from the log comment was your rationale here, and
> that seems pretty reasonable. Here are a couple of caveats for my comments to
> follow:
>
> * We agreed that Wonder 7 need not maintain backwards compatibility—I was
> (and continue to be) a big proponent of this.
> * WOUnit is advertised as being built on Wonder 5, which, again, is perfectly
> fine.
>
> However, in the course of upgrading our Jenkins build server to Java 8, and
> bringing in the latest Wonder 7 frameworks from master, I hit two issues:
>
> 1. With the new method signature for arrayMinusArray(), WOUnit’s
> MockEditingContext can’t even find that method:
>
> java.lang.NoSuchMethodError:
> er.extensions.foundation.ERXArrayUtilities.arrayMinusArray(Lcom/webobjects/foundation/NSArray;Lcom/webobjects/foundation/NSArray;)Lcom/webobjects/foundation/NSArray;
> at
> com.wounit.rules.MockEditingContext.saveChanges(MockEditingContext.java:310)
>
>
> It’s not immediately clear to me why this would be the case, as obviously
> NSArray implements Collection, and the new signature is:
>
> public static <T> NSArray<T> arrayMinusArray(Collection<T> array,
> Collection<?> minus)
>
> 2. Of greater concern is that the new arrayMinusObject() method seems to
> cause ERXEOControlUtilities.validateUniquenessOf() to throw a uniqueness
> violation exception when it shouldn’t—as far as I can tell,
> arrayMinusObject() _isn’t removing the object from the array_.
>
> Rolling back the changes to these two methods made in 1d56e6d6 fixes both of
> these problems. I guess I’m just after your commentary: is it obvious to you
> why MockEditingContext can’t even find that method, and, even if I have to
> live with that one, would you agree that the second change seems to have
> broken ERXEOControlUtilities.validateUniquenessOf()? Let me know what you
> think.
>
>
> --
> Paul Hoadley
> http://logicsquad.net/
>
>
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
