-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
None
-
rc
-
generic
-
solaris_8
-
Verified
Date: Sat, 06 Sep 2003 01:13:26 +0100
From: Russel Winder <###@###.###>
Subject: Incongruous or just a misunderstanding?
To: Neal M Gafter <###@###.###>
Cc: Graham Roberts <###@###.###>
I have a generic type DLList which is a double linked list. As an inner
class there is Iterator. I find that the compile lets me use
DLList<Pair<K, V>>.Iterator as a type name in a declaration but not as a
type name in a cast. So
DLList<Pair<K, V>>.Iterator i = (DLList<Pair<K, V>>.Iterator)X.iterator();
fails because the cast syntax is not acceptable but then that means
that:
DLList<Pair<K, V>>.Iterator i = (DLList.Iterator)X.iterator() ;
fails because there is an unchecked assignment. A priori I would have
thought the same type names could be used in both places.
From: Russel Winder <###@###.###>
Subject: Incongruous or just a misunderstanding?
To: Neal M Gafter <###@###.###>
Cc: Graham Roberts <###@###.###>
I have a generic type DLList which is a double linked list. As an inner
class there is Iterator. I find that the compile lets me use
DLList<Pair<K, V>>.Iterator as a type name in a declaration but not as a
type name in a cast. So
DLList<Pair<K, V>>.Iterator i = (DLList<Pair<K, V>>.Iterator)X.iterator();
fails because the cast syntax is not acceptable but then that means
that:
DLList<Pair<K, V>>.Iterator i = (DLList.Iterator)X.iterator() ;
fails because there is an unchecked assignment. A priori I would have
thought the same type names could be used in both places.
- relates to
-
JDK-6558462 Nested classes and reified types
-
- Closed
-