Bug 30707 - [regression] gjavah cannot handle more than one CLASS
Summary: [regression] gjavah cannot handle more than one CLASS
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: cp-tools (show other bugs)
Version: 0.93
: P3 normal
Target Milestone: 0.94
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-05 13:14 UTC by Matthias Klose
Modified: 2007-02-06 20:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-02-06 18:33:49


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2007-02-05 13:14:02 UTC
seen while building the bindings for subversion (part of the subversion source). Both gcjh and sun's javah can handle more than one CLASS for each call; the merged gjavah only writes output for the first CLASS on the command line.
Comment 1 Tom Tromey 2007-02-05 17:35:49 UTC
Hmm..  I don't see this.

opsy. gjavah -classpath . -jni -d Out java.lang.Object java.lang.Class java.lang.Thread
opsy. ls Out/java/lang/
./  ../  Class.h  Object.h  Thread.h

Do you have a test case?
Note that gjavah won't generate a JNI header for a file that has no
native methods.  Is this what you're seeing?
Perhaps this is a bug though.
Comment 2 Matthias Klose 2007-02-06 10:23:06 UTC
(In reply to comment #1)
> Hmm..  I don't see this.
> 
> opsy. gjavah -classpath . -jni -d Out java.lang.Object java.lang.Class
> java.lang.Thread
> opsy. ls Out/java/lang/
> ./  ../  Class.h  Object.h  Thread.h
> 
> Do you have a test case?
> Note that gjavah won't generate a JNI header for a file that has no
> native methods.  Is this what you're seeing?
> Perhaps this is a bug though.

yes; at least sun's javah version produces an "empty" file (when run on the example from 30706), like:

$ cat org_gnu_readline_ReadlineCompleter.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_gnu_readline_ReadlineCompleter */

#ifndef _Included_org_gnu_readline_ReadlineCompleter
#define _Included_org_gnu_readline_ReadlineCompleter
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif
Comment 3 Andrew Haley 2007-02-06 10:31:07 UTC
We still don't have a reproducible test case.

Please post the exact commands you used, what files you got, and what files you expected.
Comment 4 Matthias Klose 2007-02-06 11:04:17 UTC
(In reply to comment #3)
> We still don't have a reproducible test case.
> 
> Please post the exact commands you used, what files you got, and what files you
> expected.

- use the example from 30706
- cd src/native
- gjavah -classpath ../../build -jni org.gnu.readline.Readline org.gnu.readline.ReadlineCompleter

$ ls org/gnu/readline
Readline.h

while sun's version creates both files:
$ ls *.h
org_gnu_readline_ReadlineCompleter.h  org_gnu_readline_Readline.h

Comment 5 Tom Tromey 2007-02-06 18:33:49 UTC
Testing a patch.
Comment 6 cvs-commit@developer.classpath.org 2007-02-06 20:24:12 UTC
Subject: Bug 30707

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Tom Tromey <tromey>	07/02/06 20:23:46

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

Log message:
		PR libgcj/30707:
		* tools/gnu/classpath/tools/javah/JniIncludePrinter.java
		(printClass): Always print a header.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9089&r2=1.9090
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java?cvsroot=classpath&r1=1.5&r2=1.6



Comment 7 Tom Tromey 2007-02-06 20:27:32 UTC
Subject: Bug 30707

Author: tromey
Date: Tue Feb  6 20:27:16 2007
New Revision: 121664

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121664
Log:
	PR libgcj/30707:
	* tools/gnu/classpath/tools/javah/JniIncludePrinter.java
	(printClass): Always print a header.

Modified:
    trunk/libjava/classpath/ChangeLog
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/JniIncludePrinter.class
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java

Comment 8 Tom Tromey 2007-02-06 20:28:56 UTC
Subject: Bug 30707

Author: tromey
Date: Tue Feb  6 20:28:44 2007
New Revision: 121665

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121665
Log:
	PR libgcj/30707:
	* tools/gnu/classpath/tools/javah/JniIncludePrinter.java
	(printClass): Always print a header.

Modified:
    branches/redhat/gcc-4_1-branch-java-merge-20070117/libjava/classpath/ChangeLog
    branches/redhat/gcc-4_1-branch-java-merge-20070117/libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java

Comment 9 Tom Tromey 2007-02-06 20:30:28 UTC
Fix checked in.