Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.0-rc-1
-
None
Description
Given a Generic DTO
@groovy.transform.CompileStatic
@groovy.transform.Immutable( knownImmutableClasses = [T] )
class Data<T> {
T value
}
We can then make an iterator that returns a String variant of these:
@groovy.transform.CompileStatic class StringDataIterator implements Iterator<Data<String>> { boolean hasNext() { true } void remove() {} Data<String> next() { new Data<String>( value: 'tim' ) } }
But when we come to test this all:
@groovy.transform.CompileStatic class Runner { static main( args ) { Data<String> elem = new StringDataIterator().next() println elem.value.length() } }
We get:
[Static type checking] - Cannot find matching method java.lang.Object#length(). Please check if the declared type is right and if the method exists.