Bug 16843 - gcjh generated headers don't define final constants
Summary: gcjh generated headers don't define final constants
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-07-31 10:19 UTC by Mark Wielaard
Modified: 2016-09-30 22:49 UTC (History)
4 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2007-01-30 02:16:00


Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2004-07-31 10:19:13 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_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.
Comment 1 Andrew Pinski 2004-08-05 06:42:56 UTC
Comment 2 Tom Tromey 2004-11-08 06:30:07 UTC
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.
Comment 3 CVS Commits 2004-11-08 18:03:16 UTC
Subject: Bug 16843

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tromey@gcc.gnu.org	2004-11-08 18:03:02

Modified files:
	gcc/java       : ChangeLog gjavah.c 

Log message:
	PR java/16843:
	* gjavah.c (HANDLE_END_FIELD): Call print_field_info when
	generating a JNI header.
	(print_field_info): Handle JNI headers.
	(jni_print_float): Likewise.
	(jni_print_double): Likewise.


Comment 4 Tom Tromey 2007-01-30 02:16:00 UTC
Hmm, I thought this was fixed in gjavah, but apparently
it is not emitting the #defines either.
Comment 5 Andrew Pinski 2016-09-30 22:49:02 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.