title: Freemarker - behavior of Built-ins with Iterables
body: <p>I am observing strange behavior with Freemarker.
  I have an <code>Iterable</code> in <code>reportModel.affectedJars</code>. It is provided from a graph database - Tinkerpop/Titan.</p>
  
  <pre><code>${iterableHasContent(reportModel.affectedJars)?then("true", "false")}&lt;br&gt;
  ${reportModel.affectedJars?has_content?then("yes", "no")} has_content&lt;br&gt;
  ${reportModel.affectedJars?size}&lt;br&gt;
  ${reportModel.affectedJars}&lt;br&gt;
  &lt;#if reportModel.affectedJars?size == 0&gt;
      &lt;p&gt;No archives containing CVE vulnerabilities were found.&lt;/p&gt;
  &lt;#else&gt;
      &lt;#list reportModel.affectedJars.iterator() as file&gt;
          Something...
  </code></pre>
  
  <p><code>iterableHasContent</code> is an alternative of <code>?size</code>.
  I would expect this to  be quite consistent, in terms of:</p>
  
  <pre><code>false
  no has_content
  0
  &lt;p&gt;No archives ...
  </code></pre>
  
  <p>But what is actually happening is:</p>
  
  <pre><code>false
  yes has_content
  6
  --- and no iterations. ---
  </code></pre>
  
  <p>Which looks like there's some glitch that makes Freemarker think that the <code>Iterable</code> is not empty, but then when iterated, it gives no items. No exception is thrown.</p>
  
  <p>I was trying to debug, but the debugger doesn't stop at the relevant code for some reason.</p>
  
  <p>Is there something I am missing in <code>?size</code> and <code>?has_content</code> paradigms that allows this behavior?</p>