Review Request: JDK-8170633 backslashes in gensrc/module-info.java comments need escaping

Mandy Chung mandy.chung at oracle.com
Fri Dec 2 17:39:47 UTC 2016


The build tool generating module-info.java includes the path name of the source files in the comment for diagnosis where backslash character needs escaping.  This patch prints URI rather than file path.

Mandy

diff --git a/make/src/classes/build/tools/module/GenModuleInfoSource.java b/make/src/classes/build/tools/module/GenModuleInfoSource.java
--- a/make/src/classes/build/tools/module/GenModuleInfoSource.java
+++ b/make/src/classes/build/tools/module/GenModuleInfoSource.java
@@ -146,9 +146,10 @@
             for (String l : lines) {
                 writer.println(l);
                 if (l.trim().startsWith("module ")) {
-                    writer.format("    // source file: %s%n", sourceFile);
+                    // print URI rather than file path to avoid escape
+                    writer.format("    // source file: %s%n", sourceFile.toUri());
                     for (Path file: extraFiles) {
-                        writer.format("    //              %s%n", file);
+                        writer.format("    //              %s%n", file.toUri());
                     }
                     break;
                 }



More information about the core-libs-dev mailing list