title: Partial branch coverage in Sonar with JaCoCo when iterating over enum's values
body: <p>In SonarQube I notice surprising behavior with constructs such as</p>
  
  <pre><code>for (final MyEnum myEnum : MyEnum.values()) {
      ...
  }
  </code></pre>
  
  <p>where <code>MyEnum</code> is a custom <code>enum</code> defined in my project. The line containing the <code>for</code> statement is shown as an uncovered branch even though the surrounding code and the body of the loop are marked as covered (and indeed they are run by at least one test).</p>
  
  <p>I do not understand this behavior. Since <code>values()</code> return <code>MyEnum[]</code>, internally, this kind of <code>for</code> loop should evaluate to something equivalent to <code>for (int i = 0; i &lt; values.length; i++) {</code> where <code>values</code> would be the result of <code>values()</code> stored into a temporary variable. Clearly there is a branch here but since there are more than 0 elements in the array, both the branch which enters the loop and the branch which breaks it get executed.</p>
  
  <p>So why do I not see this line as having complete branch coverage?</p>