Anche io sono incorso in usa situazione simile, ma è una caratteristica di java; ti riporto la risposta data sul sito della sun ad un utente che segnalava come un bug il sollevamento della ClassCastException con queste righe di codice:


Codice PHP:
       Object o[] = {"1","2"};
       
String[] = (String[]) o

Risposta:


Not a bug. The VM is behaving according to the JLS.
The rules for casting in JLS 5.5 do not permit
a value of runtime class Object[] to be converted to String[], even if the actual values of the elements all happen to be string. Consider, for example, that an Object[] may have elements of different types, and the runtime cannot know, without looking at the actual values of each element, that they can all be converted to a String. The JLS rules are designed to avoid examining the
values in this way.

The compiler must accept a cast from Object[] to String[], however, since an Object[] variable may in fact hold a value whose runtime class is String[].