Custom task property of type Configuration does not generate setter method

I have a custom task with a ‘Configuration’ property. When I attempt to set this property using the property as a method, gradle reports a missing method exception.

Attempting to set the value using the ‘=’ equals sign works, as does manually creating the missing method.

Code and Stacktrace: https://gist.github.com/danthegoodman/90027bc90b0e660ecf85

Tested with versions: 2.2.1 and 2.1 and 2.0

apply plugin: 'java'
  task allowed(type: MyTask){
  obj = configurations.compile
  obj configurations.compile
  cfg = configurations.compile
}
  task broken(type: MyTask){
  cfg configurations.compile
}
  class MyTask extends DefaultTask {
  Object obj
  Configuration cfg
    @TaskAction
  def act(){
     println "${name}.obj :: ${obj}"
     println "${name}.cfg :: ${cfg}"
   }
}

Hey,

in groovy when calling ‘cfg = configuration.compile’ under the hood, the method ‘setCfg(Configuration)’ is called. But there is no build-in support for the syntax you use in your “broken” task.

“cfg configuration.compile” will be resolved in groovy to call a method 'cfg(Configuration) which doesn’t match the property syntax of groovy. Gradle itself added some of these methods to it’s model classes to make the usage more convenient. This might have mislead you to the assumption this is build-in groovy syntax

Ah, sorry. I believe I communicated poorly.

I understand that Gradle is adding these methods to the task and that this is not groovy syntax.

My issue report is that the ‘cfg(Configuration)’ method is not being created by Gradle even though ‘obj(Object)’ is.

My understanding is that “setter methods” are created for all task properties except collections. Since ‘Configuration’ extends ‘FileCollection’, no such method is created.

I see. Thank you for the insight!