I've applied a couple of patches (attached) to fix some long standing
javah issues:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40188
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45527
These fixes allow gjavah to generate header files during the OpenJDK
build in the same way as the OpenJDK javah.
ChangeLog:
2011-07-07 Andrew John Hughes <[email protected]>
PR classpath/45527
* tools/gnu/classpath/tools/javah/JniHelper.java:
(mangle(String)): Replace '$' with '_' rather than
encoding it as hex.
2011-07-07 Andrew John Hughes <[email protected]>
PR classpath/40188
* tools/gnu/classpath/tools/javah/JniIncludePrinter.java:
(writeFields(ClassWrapper,JniPrintStream)): Retain a
reference to the original class and use it in naming
fields, as opposed to the class in which it occurs.
--
Andrew :)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37
Index: tools/gnu/classpath/tools/javah/JniIncludePrinter.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java,v
retrieving revision 1.11
diff -u -u -r1.11 JniIncludePrinter.java
--- tools/gnu/classpath/tools/javah/JniIncludePrinter.java 3 Jun 2010
19:14:37 -0000 1.11
+++ tools/gnu/classpath/tools/javah/JniIncludePrinter.java 7 Jul 2011
10:13:22 -0000
@@ -63,6 +63,7 @@
{
klass.linkSupers();
boolean wroteAny = false;
+ ClassWrapper headerClass = klass;
for (; klass != null; klass = klass.superClass)
{
Iterator<?> i = klass.fields.iterator();
@@ -77,7 +78,7 @@
continue;
// Note that we don't want to mangle the field name.
- String name = (JniHelper.mangle(klass.name) + "_" + field.name);
+ String name = (JniHelper.mangle(headerClass.name) + "_" +
field.name);
out.print("#undef ");
out.println(name);
out.print("#define ");
Index: tools/gnu/classpath/tools/javah/JniHelper.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/javah/JniHelper.java,v
retrieving revision 1.4
diff -u -u -r1.4 JniHelper.java
--- tools/gnu/classpath/tools/javah/JniHelper.java 3 Jun 2010 19:14:37
-0000 1.4
+++ tools/gnu/classpath/tools/javah/JniHelper.java 7 Jul 2011 11:27:22
-0000
@@ -104,6 +104,8 @@
result.append("_3");
else if (c == '/')
result.append("_");
+ else if (c == '$')
+ result.append("_");
else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z'))
result.append(c);