Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.5
-
None
Description
The groovy.lang.Range type returns Comparable from getTo() and getFrom(). However, Range is a generic interface and the generic type T could be used instead. This is useful when using @TypeChecked or @CompileStatic as it allows groovy to infer the correct type.
Here's a simple test case:
@groovy.transform.CompileStatic
def test(Range<Date> r) {
println r.to.time
}
def now = new Date()
test(now..now)