Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.6
-
None
Description
I'm trying to mix a trait into a Gradle plugin. This works:
trait PluginUtils { abstract Project getProject() public <T extends Task> T createTask(String name, Class type, Closure<?> config) { project.task(name, type: type, config) } } class MyPlugin implements Plugin<Project>, PluginUtils { Project project void apply(Project project) { this.project = project createTask("foo", DefaultTask) {} } } apply plugin: MyPlugin
As soon as I change Class to Class<T> in the signature of the createTask method, gradle foo blows up with:
Caused by: java.lang.NullPointerException at com.sun.beans.TypeResolver.resolve(TypeResolver.java:203) at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218) at com.sun.beans.TypeResolver.resolve(TypeResolver.java:169) at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218) at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:96) at MyPlugin.<clinit>(/swd/tmp/traitplugin/build.gradle)
Tested with Gradle 2.1-rc-4/Groovy 2.3.6 and Gradle 2.0/Groovy 2.3.3.