ArrayList creation: (some object) cannot be stored in an array of type java.lang.Object[]
<p>Usually, the code block works perfect. On very rare occasions though, the "new ArrayList" throws an Exeption <strong>my.namespace.CacheEntry cannot be stored in an array of type java.lang.Object[]</strong>.</p>

<p>Checking Google, someone else seemed to get this exception on an Acer A500 with 3.1 (which is the device I got it, too). I don't see any hit for this in generic Java or whatever, so may be some very very Honeycomb special case or even a VM bug?</p>

<pre><code>private long expireCache(HashMap&lt;String, CacheEntry&gt; map) {
    long count = 0;
    // next line will sometimes throw the exception:
    ArrayList&lt;CacheEntry&gt; entries = new ArrayList&lt;CacheEntry&gt;(map.values());
    Collections.sort(entries);
</code></pre>

<p>The CacheEntry class is quite regular, too:</p>

<pre><code>final class CacheEntry implements Comparable&lt;CacheEntry&gt; {
    public File file;
    public Long time;

    CacheEntry(File cacheFile) {
        // retreive the lastModified only once, don't do heavy I/O for sorting,
        // keep it desynced from filesystem so nothing bad happens when the 
        // file gets changed while sorting:
        file = cacheFile;
        time = cacheFile.lastModified();
        }

     // "touch" the cached last modified time
     public void touch() {
        time = System.currentTimeMillis();
        }

     // return the long comparable of last modified time
     public int compareTo(CacheEntry c) {
        return time.compareTo(c.time);
        }
     }
</code></pre>

<p>I don't see anything wrong with this code. Anyone?</p>
