JDK-8090157 : JNI headers should be re-generated when a .java file changes
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: 8
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-12-19
  • Updated: 2024-11-23
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.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
Relates :  
Description
When I change a .java file that normally generates a JNI header file (e.g. modules/graphics/src/main/java/com/sun/glass/events/KeyEvent.java ),
the corresponding JNI header (modules/graphics/build/generated-src/headers/glass/win/com_sun_glass_events_KeyEvent.h ) is not re-generated.
I have to issue `gradle clean sdk` in order to get my build back to normal.
Comments
I suspect that this is no longer reproducible, but we need to test it. We now use 'javac -h' to rebuild the headers.
23-11-2024

I see the problem. And I understand the workaround. However, in the long term (FX9?) we should implement what you suggest - our build scripts should specify the required generated header files on a per-library basis, thus allowing us to recompile affected libraries automatically when the corresponding .java files change.
29-01-2014

The problem is that we don't have a exact mapping .java -> .h -> .c As a matter of fact, if any .h changes, all .c are build. We also don't know which classes are required by javah (most places we javah all the classes, producing several .h are not used). If we just "fix" this problem it will cause all libraries to build everytime *any* .java changes. To do this right we need to spec precisely each java header we actually need. For example, instead of MAC.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"] we need to set each required file individually. Note that we will still building all libraries if any .h changes (as we don't know which library requires which headers). As a workaround, you can: `gradle cleanNativeGlass sdk` or `gradle cleanNativeGlass nativeGlass`
10-01-2014