C++ and Java CNI: Check Java references

Mark Mitchell mark@codesourcery.com
Tue Apr 24 11:30:00 GMT 2001


>>>>> "Andrew" == Andrew Haley <aph@cambridge.redhat.com> writes:

    Andrew> I can see the logic here, but doesn't it amount to a
    Andrew> redesign of CNI?

Maybe -- I'm not by any means a CNI expert.

    Andrew> would become this:

    Andrew> jobjectArray java::io::File::performList
    Andrew> (JavaPointer<java::io::FilenameFilter> filter,
    Andrew> JavaPointer<java::io::FileFilter> fileFilter,
    Andrew> JavaPointer<java::lang::Class> result_type)

Right.

Note, too, that you could leave the interface alone and copy the
parameters to local variables with JavaPointer<...> type, if you
didn't want to change the interfaces.

Also, of course, you can make the `operator*' not do the check at all
if you have a system where you can recover from the signal handler.

This kind of pointer-checking was one of the explicit motivations
behind operator overloading and member templates in C++; it's
certainly something that C++ programers are used to doing at
user-level.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com



More information about the Java mailing list