This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Incorrect Java methods called from CNI
- From: Michael Koch <konqueror at gmx dot de>
- To: Dave Menendez <dave at sycamore dot us>, java at gcc dot gnu dot org
- Date: Fri, 7 May 2004 22:56:27 +0200
- Subject: Re: Incorrect Java methods called from CNI
- References: <1083962901.5402.47.camel@localhost.localdomain>
Am Freitag, 7. Mai 2004 22:48 schrieb Dave Menendez:
> I'm hoping that someone else has seen this problem and knows of a
> possible workaround or fix. I am using GCC 3.4.0 and GCJ to compile
> several Java -source- files. I use gcjh to generate header files for
> all these Java files. I have some C++ code that successfully
> instantiates the Java object and calls some methods on it. So far,
> things are working great.
>
> However, I've just run into a problem that didn't seem to make any
> sense, and by adding a few basic System.out.println statements
> directly in the Java source and regenerating all the files, I've
> determined that the method I invoke from C++ is actually calling the
> wrong method on the Java object. For example, in C++ I invoked
> SomeJavaObj->clear(), but according to the println's I placed in the
> Java object itself, SomeJavaObj.add() was the actual method that got
> invoked.
>
> Other methods work, but this is the first one I've come across where
> the wrong method altogether was invoked. The method I'm calling
> isn't anything out of the ordinary, like an implementation of an
> interface method, and the pointer I'm using is a pointer of the
> actual class type, not of an interface type, so I don't think I'm
> doing anything wacky here. I even tried compiling without any
> optimization (-O0) instead of the default used by autoconf/automake
> (-O2).
Can you provide a testcase for this ?
Michael