bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/29086] AbstractCollection.toArray(T[]) has 'unreachable'


From: subanark at gmail dot com
Subject: [Bug classpath/29086] AbstractCollection.toArray(T[]) has 'unreachable' code
Date: 18 Sep 2006 18:39:14 -0000


------- Comment #2 from subanark at gmail dot com  2006-09-18 18:39 -------
If the array is incompadible you will recieve an ArrayStoreException not a
ClassCastException.

I tried:

public class Test
{
   public static void main(String[] args)
   {
      String[] sa = new String[1];
      addObject(sa,new Object());
   }
   public static <T> void addObject(T[] array, Object o)
   {
      array[0] = (T)o;
   }
}

The exception that was trown when this is run is ArrayStoreException.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29086





reply via email to

[Prev in Thread] Current Thread [Next in Thread]