Extending pluging with Interfaces


I have a plugin that I’d like to allow the user to extend its behavior using information gathered by the plugin.
To do so I create a interface TaskExtension with a method apply(PluginInfo info), and used it to create a ListProperty<TaskExtension>.
And on the apply method of my plugin, I loop the properties calling them all.

My goal was to allow the others projects to implement this interface using specific information queried on the plugin to extend the plugin behavior with specific information of the plugin.

Here is a code sample.


interface TaskExtension {
    void apply(PluginInfo info)

class TaskProperties {
    final ListProperty<TaskExtension> tasks_extensions

    TaskProperties(Project project) {
        tasks_extensions = project.objects.listProperty(TaskExtension).empty()

class MyPlugin implements Plugin<Project> {
    PluginInfo info
    void apply(Project project) {

        // Do stuff and populate info...

        project.afterEvaluate {
            project.TaskProperties.tasks_extensions.get().each {

On the project side, I implement the class and call the plugin


apply plugin: 'MyPlugin'
class ExtensionImplementation implements TaskExtension { ... }

MyPlugin {
    tasks_extensions = [new ExtensionImplementation()]

But I get this when trying to run my code:

> Cannot get the value of a property of type java.util.List with element type TaskExtension as the source value contains an element of type ExtensionImplementation .

Is this a bug on my side or on gradle ?
I checked if the implementation is and instance of the main class, and it returns True.
Or maybe I’m over complexifing this and some groovy sweet magic could help me out?