title: Jenkins assigning true to boolean variable and false to def variable
body: <p>Very simple and straightforward question:</p>
  
  <p>Let's say we have this pipeline (I don't think there is a simpler example):</p>
  
  <pre><code>node {
      env.someEnvVariable = false
  
      boolean asBoolean = env.someEnvVariable ?: false
      def asDef         = env.someEnvVariable ?: false
  
      echo "asBoolean: $asBoolean"   // prints true because of Jenkins
      echo "asDef: $asDef"           // prints false
  }
  </code></pre>
  
  <p>Why????</p>
  
  <p>Defining a variable as <code>boolean</code> makes Jenkins assign it a true value but defining it as <code>def</code> assign it the real false value</p>
  
  <p>Where is taking Jenkins that <code>true</code> value from?</p>
  
  <p>edit: another example:</p>
  
  <pre><code>node {
      env.someEnvVariable = false
      boolean someBoolean = false
      def someVar = false
  
      echo "envVar: ${env.someEnvVariable}"     // prints false
      echo "someBoolean: ${someBoolean}"        // prints false
      echo "someVar: ${someVar}"                // prints false
      if (env.someEnvVariable != null) {
          someBoolean = env.someEnvVariable
          someVar = env.someEnvVariable
      }
      echo "envVar: ${env.someEnvVariable}"     // prints false
      echo "someBoolean: ${someBoolean}"        // prints true because of hack
      echo "someVar: ${someVar}"                // prints false
  }
  </code></pre>