JDK-7150368 : javac should include basic ability to generate native headers
Type:Enhancement
Component:tools
Sub-Component:javac
Affected Version:8
Priority:P3
Status:Closed
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2012-03-02
Updated:2017-05-17
Resolved:2012-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
It would make sense if javac could generate native headers for classes containing native methods.
Comments
Suggested text for release notes:
javac now provides the ability to generate native headers as needed. This removes the need to run the javah tool as a separate step in the build pipeline. The feature is enabled in javac by using the new -h option, which is used to specify a directory in which the header files should be written. Header files will be generated for any class which has either native methods, or constant fields annotated with a new annotation of type java.lang.annotation.Native.
11-12-2013
impl and tests: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/b14d9583ce92
21-08-2013
EVALUATION
This could be enabled by a new "output directory" option, -h.
In addition, some minor changes to javax.tools would be desirable
1. new StandardLocation NATIVE_HEADER_OUTPUT
2. new annotation javax.tools.annotation.GenerateNativeHeaders
The latter is to annotate classes for which a native header should be generated but which do not contain any native methods. This might be for native code to access public static final fields defined in a Java source file.