title: Groovy passes boxed types to Jenkins, how to unbox?
body: <p>I'm trying to write a Jenkins pipeline that would restart Jenkins once a week if no jobs are running. Since I don't want to block running jobs for too long, I'm trying to call <code>doQuietDown</code> with the timeout argument.</p>
  
  <p><a href="https://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html#doQuietDown-boolean-int-" rel="nofollow noreferrer">https://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html#doQuietDown-boolean-int-</a></p>
  
  <p>So that's what I'm trying:</p>
  
  <pre><code>        stage('Quiet Down') {
              steps {
                  script {
                      boolean doBlock = true
                      int timeout_ms = 30000
                      Jenkins.doQuietDown(doBlock, timeout_ms)
                  }
              }
          }
  </code></pre>
  
  <p>That fails:</p>
  
  <pre class="lang-none prettyprint-override"><code>hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: static jenkins.model.Jenkins.doQuietDown() is applicable for argument types: (java.lang.Boolean, java.lang.Integer) values: [true, 30000]
  Possible solutions: doQuietDown(boolean, int), doQuietDown()
      at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
      at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
  </code></pre>
  
  <p>So groovy is passing boxed types, but Jenkins expects unboxed types. I tried casts to unboxed types, <code>booleanValue()</code> and <code>intValue()</code>, using <code>true</code> and <code>30000</code> without variables, but all that made no difference to the error message.</p>
  
  <p>I also tried <code>Jenkins.doQuietDown block: doBlock, timeout: timeout_ms</code> but it's passing <code>LinkedHashMap</code>:</p>
  
  <pre class="lang-none prettyprint-override"><code>jenkins.model.Jenkins.doQuietDown() is applicable for argument types: (java.util.LinkedHashMap) values: [[block:true, timeout:30000]]
  </code></pre>
  
  <p>I'm using Jenkins 2.180 (the current version at the time of this posting)</p>