GCC Bugzilla – Bug 16843
gcjh generated headers don't define final constants
Last modified: 2007-01-30 02:16:00 UTC
Some JNI header generators like kaffeh output C #defines for final static
(primitive and String) fields. gcjh doesn't do this.
The output of running kaffeh on the following class:
public class T extends Thread
public static final String Hello = "World";
public static final float f = 1.4f;
public static final double d = Math.PI;
gets you the following defines in T.h:
#define T_MIN_PRIORITY 1
#define T_NORM_PRIORITY 5
#define T_MAX_PRIORITY 10
#define T_Hello "World"
#define T_f 1.4000000e+00
#define T_d 8.6191995128153828e+97
Note that some of these constants come from the super class.
Also note that the float and double results look like bugs in kaffeh.
Unfortunately I cannot find the specification that defines this behaviour.
I'm testing a patch to emit those constants defined
in the class itself. Inherited not constants are
not emitted; this is harder and related to PR 15411
(in both cases we would have to read other class files
and understand inheritance).
Fixing this partially will help at least building
the subversion java bindings.
Subject: Bug 16843
Module name: gcc
Changes by: email@example.com 2004-11-08 18:03:02
gcc/java : ChangeLog gjavah.c
* gjavah.c (HANDLE_END_FIELD): Call print_field_info when
generating a JNI header.
(print_field_info): Handle JNI headers.
Hmm, I thought this was fixed in gjavah, but apparently
it is not emitting the #defines either.