|
From: Scott M S. <sco...@jb...> - 2006-07-12 15:52:59
|
That is a rather basic generics error that is a bug in javac since
Properties is typed as Map<Object,Object>, not Map<String,String>. You
are asking to be able to do (replacing ? with String to be more
concrete):
Map<Object,Object> m1 =3D ...;
Map<String,String> m2 =3D (Map<String,String>) m1;
javac disallows this as it should since one would be able to do the
following otherwise:
m1.put("one", new Integer(1));
String one =3D m2.get("one"); // CCE since Integer !instanceof String
In the Properties case javac must be getting lost in the non-trivial
inheritance tree. See the following for discussions of the less
intuitive aspects of generics:
http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
> -----Original Message-----
> From: hib...@li...=20
> [mailto:hib...@li...] On=20
> Behalf Of Max Rydahl Andersen
> Sent: Wednesday, July 12, 2006 3:57 AM
> To: Hibernate development
> Subject: [Hibernate] eclipse chokes on current annotations code
>=20
>=20
> javac works fine, but eclipse chokes on casting Properties to=20
> Map<String, ?>
>=20
> I've bugged eclipse about it to see what they provide as explanation.
>=20
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=3D150362
>=20
|