[GitHub] groovy pull request #566: Added IgnoreDefaultEqualsAndToString
Github user melix commented on a diff in the pull request: https://github.com/apache/groovy/pull/566#discussion_r166253411 --- Diff: src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java --- @@ -12026,6 +12026,9 @@ public static boolean equals(List left, List right) { if (left == right) { return true; } +if( left.getClass().getAnnotation(IgnoreDefaultEqualsAndToString.class)!=null && right.getClass().getAnnotation(IgnoreDefaultEqualsAndToString.class)!=null ) { --- End diff -- I have nothing particular in mind at this point, but it involves this method being called with different kind of objects, and comparing with the baseline without the change. ---
[GitHub] groovy pull request #566: Added IgnoreDefaultEqualsAndToString
Github user pditommaso commented on a diff in the pull request: https://github.com/apache/groovy/pull/566#discussion_r166250753 --- Diff: src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java --- @@ -12026,6 +12026,9 @@ public static boolean equals(List left, List right) { if (left == right) { return true; } +if( left.getClass().getAnnotation(IgnoreDefaultEqualsAndToString.class)!=null && right.getClass().getAnnotation(IgnoreDefaultEqualsAndToString.class)!=null ) { --- End diff -- Could you suggest a possible metrics/benchmark ? ---
[GitHub] groovy pull request #566: Added IgnoreDefaultEqualsAndToString
Github user melix commented on a diff in the pull request: https://github.com/apache/groovy/pull/566#discussion_r166246347 --- Diff: src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java --- @@ -12026,6 +12026,9 @@ public static boolean equals(List left, List right) { if (left == right) { return true; } +if( left.getClass().getAnnotation(IgnoreDefaultEqualsAndToString.class)!=null && right.getClass().getAnnotation(IgnoreDefaultEqualsAndToString.class)!=null ) { --- End diff -- -1 to this until we have a better idea on the impact on performance. Calling `getClass().getAnnotation(...)` is **very** expensive. ---
[GitHub] groovy pull request #566: Added IgnoreDefaultEqualsAndToString
GitHub user pditommaso opened a pull request: https://github.com/apache/groovy/pull/566 Added IgnoreDefaultEqualsAndToString This annotation allows custom `Collection` and `Map` objects to bypass the default Groovy format and equality methods ie. `toString` and `equals`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/pditommaso/groovy ignore-default-groovy-methods Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/566.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #566 commit 8a9f43b4c937c8bce8674f75d1fe7b9575b7c740 Author: Paolo Di Tommaso Date: 2017-06-25T18:26:18Z Added @IgnoreDefaultEqualsAndToString annotation that allows by-pass Groovy equals and toString methods for Map and Collection objects --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---