Yes, though this is specific to methods with one parameter and only occurs
if the method call is not statically compiled. See
http://glaforge.appspot.com/article/groovy-default-params-to-avoid-one-argument-methods-being-called-without-params
for
a discussion.

On Tue, May 3, 2016 at 3:58 PM Guy Matz <[email protected]> wrote:

> I have a method that starts like this:
>
> class Sidecar {
>
>   def static String getVersions(String render_server) {
>
>     def rest = new RESTClient('http://' + render_server)
>
>     try {
>
>       def vpath = *'*/r/api/versions'
>       log.debug "Hitting http://${render_server}${vpath}";
>       def resp = rest.get(path:vpath)
>
>
> and when I call it as Sidecar.getVersions('server-name') it works as 
> expected.  When I "accidentally" call it without a parameter, though, Groovy 
> does not complain until it attempts the REST call:
>
> groovy:000> r = Sidecar.getVersions()
>
> 15:49:41.209 [main] DEBUG com.jcrew.jenkins.helpers.Sidecar - Hitting 
> http://*null*/r/api/versions
>
>
> Is Groovy defaulting the parameter to null when it's not supplied?
>
>

Reply via email to