Issue Details (XML | Word | Printable)

Key: GROOVY-1995
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexandru Popescu
Reporter: Hauke Plambeck
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

minus(List self, Collection removeMe) throws IllegalStateException for dupplicate values

Created: 23/Jul/07 12:11 PM   Updated: 23/Dec/07 12:25 PM   Resolved: 05/Oct/07 04:16 PM
Component/s: groovy-jdk
Affects Version/s: 1.0, 1.1-beta-1, 1.1-beta-2
Fix Version/s: 1.1-rc-1

Time Tracking:
Not Specified

File Attachments: 1. Java Source File DefaultGroovyMethods.java (261 kB)
2. File MinusTest.groovy (2 kB)


Testcase included: yes
Patch Submitted: Yes


 Description  « Hide

DefaultGroovyMethods.minus(List, Collection removeMe) and DefaultGroovyMethods.NumberAwareComparator have two problems.<br>

1. dupplicate values that are not Comparable cause IllegalStateExceptions
<code>
def a = new Object()
// throws IllegalStateException
assert [] == [ a ] - [ a, a ]
</code><br>
2. null values are not removed from a List
<code>
// fails
assert [] == [ null ] - [ null ]
</code><br>
I have attached a unit test and a fix based on the groovy-1.1-beta-2 source.



Alexandru Popescu added a comment - 05/Oct/07 04:16 PM

Committed in r.8376. Thanks.

./alex

.w( the_mindstorm )p.