I'm trying to 'mend' some other code that I've been upgrading.
I've boiled it down to a simple example generic class and then the use of that class.
First, I declared a generic parameterized class like so
//generic class
class WillsAgent<T> {
public WillsAgent(T data) {//do nothing with this }
}
Then a consuming class that tries to use this like so
@CompileStatic
public abstract class Test<T> {
public WillsAgent<T> agent( T state) {
final WillsAgent<T> safe = new WillsAgent<T> (state)
return safe
}
}
with the @CompileStatic declaration in play, the IDE shows a red squiggle under (state) passing the parameter to the constructor like this
If I comment out the @CompileStatic declaration - the error disappears
If i hover over the squiggle (with @CompileStatic enabled) it shows this: Constructor 'WillsAgent' in 'groovyx.gpars.agent.WillsAgent<T>' cannot be applied to '(T)'
I can't figure out how to correct this, other than removing the @CompileStatic
Does anyone have any ideas why it's complaining this and what to do to fix it?