If I execute the following task repeatedly it will always be executed because the up to data check fails and reports that the instance property changed.:
task gradlebug(type: Gradlebug) {
outDir file('bug')
}
class Gradlebug extends ConventionTask
{
@Input
@Optional
SomeClass instance = new SomeClass();
@OutputDirectory
File outDir
@TaskAction
void doSomething() {
println "done"
}
}
class SomeClass implements Serializable {
boolean equals(Object o) {
println getClass().getClassLoader()
println o.getClass().getClassLoader()
return getClass() == o.getClass();
}
}
The problem did not exist with 1.10, but exists in 1.11 and 1.12. For 1.10 the 'ClassLoader’s of ‘SomeClass’ are the same instance, starting with 1.11 they are different instances which causes the ‘getClass() == o.getClass()’ check to return false.