C++ and Java CNI: Check Java references

Andrew Haley aph@cambridge.redhat.com
Wed Apr 25 02:23:00 GMT 2001


Tom Tromey writes:
 > >>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
 > 
 > >> jobjectArray
 > >> java::io::File::performList (JavaPointer<java::io::FilenameFilter> filter, 
 > >> JavaPointer<java::io::FileFilter> fileFilter, 
 > >> JavaPointer<java::lang::Class> result_type)
 > 
 > Interestingly, Andrew's example is incorrect.  You also need
 > JavaPointer<jobjectArray>.

Why's that?  Surely the definition of jobjectArray would be a typedef
of a JavaPointer.

Anyway, it's just dawned on me that this solution could never work:
the `this' pointer in C++ isn't a smart pointer, so references to
instance data and methods would not be checked.  We'd always have to
copy `this' to a smart pointer and reference instance data via that.
(Or check `this' at method entry.)  This is all getting rather
horrible.

I think we should go with Plan A.

Andrew.



More information about the Java mailing list