The soa-model code uses the List.minus() method (listA - listB) regularly on Lists containing different kinds of SchemaComponents.
But underlying List.minus() is very inefficient when the elements do not implement the Comparable interface. List.minus() is implemented in org.codehaus.groovy.runtime.DefaultGroovyMethods by public static List minus(List self, Collection<?> removeMe)
If the List elements do not implement Comparable a RuntimeException is thrown and catched before the hashCode of the elements is used for the equality check.
(To find out the exact way this works in Groovy you can have a look at
DefaultTypeTransformation.compareToWithEqualityCheck(), org.codehaus.groovy.runtim.DefaultTypeTransformation.compareEqual and
org.codehaus.groovy.runtime.NumberAwareComparator)
It would be much more efficient to have all SchemaElements implement equals + hashCode
The soa-model code uses the List.minus() method (listA - listB) regularly on Lists containing different kinds of SchemaComponents.
But underlying List.minus() is very inefficient when the elements do not implement the Comparable interface. List.minus() is implemented in org.codehaus.groovy.runtime.DefaultGroovyMethods by public static List minus(List self, Collection<?> removeMe)
If the List elements do not implement Comparable a RuntimeException is thrown and catched before the hashCode of the elements is used for the equality check.
(To find out the exact way this works in Groovy you can have a look at DefaultTypeTransformation.compareToWithEqualityCheck(), org.codehaus.groovy.runtim.DefaultTypeTransformation.compareEqual and org.codehaus.groovy.runtime.NumberAwareComparator)
It would be much more efficient to have all SchemaElements implement equals + hashCode