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: tromey at gcc dot gnu dot org
Subject: [Bug classpath/29086] AbstractCollection.toArray(T[]) has 'unreachable' code
Date: 18 Sep 2006 16:32:06 -0000


------- Comment #1 from tromey at gcc dot gnu dot org  2006-09-18 16:32 -------
I think that (T) cast is not a no-op.
T is a type parameteer of toArray.
However the container is parameterized by E, a different type variable.
Our iterator has type Iterator<E>, so the result of
itr.next() has type E.  So, an explicit cast is still needed.
We can get a ClassCastException if the user passes in an array whose
type is not compatible with E.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |WAITING


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





reply via email to

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