bad java compiler optimization?
<p>I have this piece of code:</p>

<pre><code>private void prepareContent() {
    log.info("do something");
    // success?
    boolean suc = false;
    suc = suc || uncompressToContent("file.tar.gz");
    suc = suc || uncompressToContent("file.tgz");
    for (int i = 0; i &lt;= 9; i++) {
        suc = suc || uncompressToContent("dir/" + i + ".tgz");
        suc = suc || uncompressToContent("dir/" + i + ".tar.gz");
    }
    if (!suc) {
        log.error("unable to do something");
    }
}
</code></pre>

<p>The function returns false for "file.tar.gz" and file.tgz".</p>

<p>The problem is the the call to uncompressToContent("dir/1.tgz") returns true and the code stops its execution.  The remaining code is not executed.</p>

<p>I'm not sure if this is an error in the compiler. What do you think?</p>

<p>Added:  I forgot to mention that I need to execute all the calls to uncompressToContent and check if any returns true, using the fewer instructions as possible.</p>
