This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]