In certain circumstances, calling private methods inside DSL enhanced objects (typically either Task implementations or extensions) will produce strange results. This only affects classes implemented in Groovy.
There are two known issues:
1. Method arguments are not type coerced according to normal Groovy rules (e.g. GStrings automatically converted to strings)
2. Checked exceptions thrown by the called method will be wrapped in a GradleException (a runtime exception)
The workaround for this is to:
1. Factor the private method out of the decorated class
2. Ensure that the method is called with accurately typed parameters (i.e. all arguments are strongly typed and are assignment compatible with their associated parameter type)
#2 Can be said another way as: the method call should succeed according to Java semantics, not Groovy semantics.