title: Calling a Closure from jenkins-library inside job's pipeline
body: <p>I have jenkins_library with handleCheckout.groovy which handles checkout:</p>
  
  <pre><code>def handleCheckout = {
      if (env.gitlabMergeRequestId) {
          sh "echo 'Merge request detected. Merging...'"
          checkout([
                  $class           : 'GitSCM',
                  branches         : [[name: "${env.gitlabSourceNamespace}/${env.gitlabSourceBranch}"]],
                  extensions       : [
                          [$class: 'PruneStaleBranch'],
                          [$class: 'CleanCheckout'],
                          [
                                  $class : 'PreBuildMerge',
                                  options: [
                                          fastForwardMode: 'NO_FF',
                                          mergeRemote    : env.gitlabTargetNamespace,
                                          mergeTarget    : env.gitlabTargetBranch
                                  ]
                          ]
                  ],
                  userRemoteConfigs: [
                          [
                                  credentialsId: env.CREDENTIALS_ID,
                                  name         : env.gitlabTargetNamespace,
                                  url          : env.gitlabTargetRepoSshURL
                          ],
                          [
                                  credentialsId: env.CREDENTIALS_ID,
                                  name         : env.gitlabSourceNamespace,
                                  url          : env.gitlabSourceRepoSshURL
                          ]
                  ]
          ])
  
      } else {
          sh "echo 'No merge request detected. Checking out current branch'"
          checkout([
                  $class           : 'GitSCM',
                  branches         : [[name: "${env.sourceBranch}"]],
                  extensions       : [
                          [$class: 'PruneStaleBranch'],
                          [$class: 'CleanCheckout']
                  ],
                  userRemoteConfigs: [[credentialsId: env.CREDENTIALS_ID, url: env.GIT_URL]]
          ])
      }
  }
  </code></pre>
  
  <p>I'm trying to call it from pipeline after imporing jenkins-library like that:</p>
  
  <pre><code>@Library('jenkins-util-lib') _
  
   stage('prepare') {
              sh "env | sort"
              handleCheckout()
  </code></pre>
  
  <p>It ends with error:</p>
  
  <pre><code>No signature of method: handleCheckout.call() is applicable for argument types: () values: []
  Possible solutions: wait(), any(), wait(long), main([Ljava.lang.String;), any(groovy.lang.Closure), each(groovy.lang.Closure)
  </code></pre>
  
  <p>Works well while method is declared and called inside the pipeline. </p>