RFR: 8056252, Incremental build fails on Windows

Andreas Lundblad andreas.lundblad at oracle.com
Thu Aug 28 14:50:49 UTC 2014


Hi compiler-dev,

Please review this patch which addresses part of JDK-8056252.

- Description:
Sjavac incorrectly translates directory names to packages by .replace('/', '.'). This in inappropriate on Windows which uses '\' as path separator.

No test added in this patch, as the SJavac.java test fails before the patch is applied and passes after.

- Links to bug report:
https://bugs.openjdk.java.net/browse/JDK-8056252


Patch inlined below (kudos to Erik Joelsson for figuring this out!):

diff -r a75064469e3f src/jdk.compiler/share/classes/com/sun/tools/sjavac/Source.java
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Source.java   Wed Aug 27 11:41:03 2014 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Source.java   Thu Aug 28 16:48:39 2014 +0200
@@ -313,7 +313,7 @@
             int sp = fn.lastIndexOf(File.separatorChar);
             String pkg = "";
             if (sp != -1) {
-                pkg = fn.substring(0,sp).replace('/','.');
+                pkg = fn.substring(0,sp).replace(File.separatorChar,'.');
             }
             // Is this a module-info.java file?
             if (fn.endsWith("module-info.java")) {



-- Andreas


More information about the compiler-dev mailing list