NullPointerException when accessing property of Extensions super class

the following worked until 1.7 and does not in 1.8, 1.9 and 1.10

class CommonData {

String content = ‘value’

}

class SpecificData extends CommonData {

public SpecificData() {

setContent(‘specificValue’) // works fine in all versions

content = ‘specificValue’ // throws NullPointerException since 1.8

}

}

class MyPlugin implements Plugin {

void apply(Project project) {

project.extensions.create(‘data’, SpecificData)

}

}

apply(plugin: MyPlugin)

println data.content

and the resulting stacktrace contains the following

Caused by: java.lang.NullPointerException

at SpecificData_Decorated.setProperty(Unknown Source)

at SpecificData.(build.gradle:7)

at SpecificData_Decorated.(Unknown Source)

at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:39)

… 70 more

Thanks for the report.

I’ve raised GRADLE-2981 and will look into it.