Bug 40188

Summary: javah creates constants using name of superclass
Product: classpath Reporter: Andrew John Hughes <gnu_andrew>
Component: cp-toolsAssignee: Andrew John Hughes <gnu_andrew>
Status: RESOLVED FIXED    
Severity: normal CC: bug-classpath
Priority: P3    
Version: 0.98   
Target Milestone: 0.99   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2009-07-26 00:38:49
Bug Depends on:    
Bug Blocks: 39410    

Description Andrew John Hughes 2009-05-18 19:01:12 UTC
The OpenJDK7 b58 build fails with:

/usr/bin/gcc  -O3   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN -g   -D_amd64_ -Damd64 -DARCH='"amd64"' -DLINUX -DRELEASE='"1.7.0_0"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LP64=1 -I. -I/mnt/builder/icedtea/openjdk-ecj/build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders -I../../../src/solaris/javavm/export -I../../../src/share/javavm/export -I../../../src/share/native/sun/nio/ch -I../../../src/share/native/java/io -I../../../src/share/native/java/net -I../../../src/solaris/native/java/net -I/mnt/builder/icedtea/openjdk-ecj/build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/../../../java.lang/java/CClassHeaders -I../../../src/share/native/common -I../../../src/solaris/native/common -I../../../src/share/native/java/nio -I../../../src/solaris/native/java/nio    -c -o /mnt/builder/icedtea/openjdk-ecj/build/linux-amd64/tmp/java/java.nio/nio/obj64/ServerSocketChannelImpl.o  ../../../src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
../../../src/solaris/native/sun/nio/ch/FileDispatcherImpl.c: In function 'Java_sun_nio_ch_FileDispatcherImpl_lock0':
../../../src/solaris/native/sun/nio/ch/FileDispatcherImpl.c:195: error: 'sun_nio_ch_FileDispatcherImpl_NO_LOCK' undeclared (first use in this function)
../../../src/solaris/native/sun/nio/ch/FileDispatcherImpl.c:195: error: (Each undeclared identifier is reported only once
../../../src/solaris/native/sun/nio/ch/FileDispatcherImpl.c:195: error: for each function it appears in.)
../../../src/solaris/native/sun/nio/ch/FileDispatcherImpl.c:197: error: 'sun_nio_ch_FileDispatcherImpl_INTERRUPTED' undeclared (first use in this function)

This is because gjavah generates the INTERRUPTED and NO_LOCK constants as:

sun_nio_ch_FileDispatcher_INTERRUPTED
sun_nio_ch_FileDispatcher_NO_LOCK

i.e. after the class in which they occur, not the class for which they are being generated.
Comment 1 Andrew John Hughes 2011-07-07 11:44:38 UTC
CVSROOT:        /sources/classpath
Module name:    classpath
Changes by:     Andrew John Hughes <gnu_andrew> 11/07/07 11:00:54

Modified files:
       .              : ChangeLog
       tools/gnu/classpath/tools/javah: JniIncludePrinter.java

Log message:
       PR classpath/40188: javah creates constants using name of the superclass

       2011-07-07  Andrew John Hughes  <ahughes@redhat.com>

               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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9829&r2=1.9830
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java?cvsroot=classpath&r1=1.11&r2=1.12