This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Checked casts in CNI
- From: Anthony Green <green at redhat dot com>
- To: java at gcc dot gnu dot org
- Date: Mon, 06 Jun 2005 08:13:12 -0700
- Subject: Checked casts in CNI
I'm slowly debugging Azureus.
The most recent problem I hit was some CNI code in
natPlainDatagramSocketImplPosix.cc that was casting a Boolean into a
InetAddress. I have a rough patch for this now, but I wonder what other
bugs like this exist.
I think it would be useful to have a new CNI casting macro that would
call isAddressableFrom() and throw ClassCastExceptions.
So, instead of
addr = (::java::net::InetAddress *) value;
you would write:
addr = _Jv_CheckedCast (::java::net::InetAddress, value);
or something like that. What do you think?
AG