This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: Reflection and gcj
- To: Anand Krishnaswamy <anandkr at nortelnetworks dot com>
- Subject: Re: Reflection and gcj
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Wed, 08 Dec 1999 12:18:46 +1300
- CC: "'java-discuss at sourceware dot cygnus dot com'" <java-discuss at sourceware dot cygnus dot com>
- References: <F908F961B7CDD111BC720000F8073E4301E85C96@crchy271.us.nortel.com>
> Anand Krishnaswamy wrote:
> I need to use reflection for some purpose and it appears that gcj does not
> have implementation for a few methods. I get the following error message at
> run-time and the program aborts.
>
> libgcj failure: java::lang::Class::getMethod not implemented.
Reflection support in libgcj isn't quite finished and debugged yet. However,
AFAIK all the required metadata for a complete JDK-1.1-level implementation
right there in Class.h. Its just a matter of sitting down and finishing the
runtime support, which shouldn't be a big job. Basically you just need to
implement a few methods in java/lang/natClass.cc, and fix a few minor bugs.
> In fact, I was unable to directly compile from the .java level as gcj kept
> complaining that it had not implemented anonymous arrays.
>
> DRU.java:66: sorry, not implemented: : `anonymous array' JDK1.1(TM) feature
> 1 error
>
> I had to create the bytecode and then convert it to an object file before
> linking it in with gcj. The linking had no problem from this point on and I
> was able to create the executable. The run-time problem listed above occured
> during this time.I tried another method in class Class, getDeclaredMethod, and
> I get the same error.
>
> Can anyone help me here? Do I need to upgrade the gcj version? The following
> is the gcj version information.
This is a FAQ. I'm afraid that the source parser does not yet support several
key "JDK 1.1" features. As you noted, for a lot of code you do need to use an
intermediate bytecode compiler, such as Jikes, and then run gcj on the .class
files.
> [anandkr@crchy0n9 loading]$ gcj -v
> Reading specs from /opt/lib/gcc-lib/powerpc-unknown-linux-gnu/2.95.1/specs
> Reading specs from /opt/lib/libgcj.spec
> rename spec lib to liborig
> gcc version 2.95.1 19990816 (release)
Well, if you want to build a more recent libgcj you'll need a newwer compiler.
Either my patch for gcc 2.95 here: http://waitaki.otago.ac.nz/~bryce/gcj/ or a
recent snapshot/cvs gcc.
regards
[ bryce ]