Default settings for BuildServiceParameters

How can I set default values for parameters in my BuildServiceParameters class? If I define an interface that implements BuildServiceParameters, then there’s no obvious place to set defaults at all. So I tried to use a class instead of an interface, and set defaults in the constructor:

abstract class MyServiceParameters implements BuildServiceParameters {

  public MyServiceParameters() {

  abstract ConfigurableFileCollection getFileCollection();

However, the constructor’s call to getFileCollection fails with a NullPointerException. So where can I set a default that will apply to all uses of my build service and its parameters?

What you are hitting is this: Please support @PostConstruct for Gradle instantiated classes · Issue #15760 · gradle/gradle · GitHub
For now you probably have to code your default value at the usage time, where you try to get the value of the property.