Checked casts in CNI

Anthony Green
Mon Jun 6 15:13:00 GMT 2005

I'm slowly debugging Azureus.

The most recent problem I hit was some CNI code in 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?


More information about the Java mailing list