Why is sjavac ever looking at the classes in the bootclasspath of the
boot jdk in the compilation environment?
The boot JDK should only be used to *run* sjavac. Nothing more. The
compilation environment should only be "the new world".
-- Jon
On 10/28/2014 03:40 AM, Erik Joelsson wrote:
Hello,
Please review this small fix when using sjavac. When using a bootjdk
that was built at a later date than when the source tree was initially
cloned, there is a risk that sjavac will pick up classes from the boot
classpath (rt.jar of boot jdk) instead of the source files, concluding
that the source files won't need to be built. This is only an issue
when building classes that are also present in the boot classpath of
the bootjdk, which we normally do since we are building the jdk.
The fix is to add a special option for this use case, which forces
sjavac to build source files if found, regardless of class file dates.
Bug: https://bugs.openjdk.java.net/browse/JDK-8047177
Patch inline:
diff -r 12d3dc35f0e8 make/common/JavaCompilation.gmk
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -583,8 +583,12 @@
$$(if $$(filter-out $$($1_SRCS), $$?), $(FIND) $$(@D) -name
"*.class" $(FIND_DELETE))
$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.$1_batch.tmp)
$(ECHO) Compiling $1
+ # Run with -XXuserPathsFirst to always build source files
even if there happens to
+ # be class files in the boot classpath (rt.jar of boot jdk)
with a newer modified
+ # time.
($$($1_JVM) $$($1_SJAVAC) \
$$($1_REMOTE) \
+ -XXuserPathsFirst \
-j 1 \
--permit-unidentified-artifacts \
--permit-sources-without-package \
/Erik