-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b29
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8081963 | emb-9 | Erik Joelsson | P3 | Resolved | Fixed | b29 |
Since the source layout restructuring into modules, sjavac has stopped working correctly. An example illustrates this best:
1. Do a full build
2. Add a public field to java/lang/Object.java
3. Do an incremental rebuild
What happens is that only java.base gets rebuilt. What should happen is that every module should get completely rebuilt. This is because sjavac only tracks pubapi changes inside the sources being considered for compilation and not for classes found on the classpath.
A real fix for this problem in sjavac has been suggested inJDK-8054717 but is subject to debate. In the meantime I suggest the following workaround in the makefiles:
1. To force recompilation on external dependency changes and not just local source changes, detect external dependency chnages in the makefile and remove all class files if found.
2. After calling sjavac, filter out the pubapi part of the javac_state file into a separate "pubapi" file and only let this file get updated if it has changed. Now the other module compilations may depend on the pubapi file instead of the sjavac file.
This is not a complete fix but should cover a large part of the usecases, and most importantly, makes you able to trust the build when using sjavac. When making changes to source code without affecting public apis, only files in the changed package should get recompiled.
1. Do a full build
2. Add a public field to java/lang/Object.java
3. Do an incremental rebuild
What happens is that only java.base gets rebuilt. What should happen is that every module should get completely rebuilt. This is because sjavac only tracks pubapi changes inside the sources being considered for compilation and not for classes found on the classpath.
A real fix for this problem in sjavac has been suggested in
1. To force recompilation on external dependency changes and not just local source changes, detect external dependency chnages in the makefile and remove all class files if found.
2. After calling sjavac, filter out the pubapi part of the javac_state file into a separate "pubapi" file and only let this file get updated if it has changed. Now the other module compilations may depend on the pubapi file instead of the sjavac file.
This is not a complete fix but should cover a large part of the usecases, and most importantly, makes you able to trust the build when using sjavac. When making changes to source code without affecting public apis, only files in the changed package should get recompiled.
- backported by
-
JDK-8081963 Work around sjavac limitation with public api tracking cross modules
-
- Resolved
-
- relates to
-
JDK-8054717 SJavac should track changes in the public apis of classpath classes!
-
- Closed
-