changeset 58873:1daf5d6e017c foreign

8221178: SrcGenTest fails on Windows Summary: Manually escape backslashes in generated paths Reviewed-by: mcimadamore
author jvernee
date Thu, 21 Mar 2019 01:34:40 +0100
parents a3d7d90a369a
children f3ef3e5a757d 4f165b569a2d
files src/jdk.jextract/share/classes/com/sun/tools/jextract/JavaSourceFactory.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jextract/share/classes/com/sun/tools/jextract/JavaSourceFactory.java	Wed Mar 20 22:26:22 2019 +0530
+++ b/src/jdk.jextract/share/classes/com/sun/tools/jextract/JavaSourceFactory.java	Thu Mar 21 01:34:40 2019 +0100
@@ -99,7 +99,7 @@
         global_jsb.addPackagePrefix(headerFile.pkgName);
 
         Map<String, Object> header = new HashMap<>();
-        header.put("path", headerFile.path.toAbsolutePath().toString());
+        header.put("path", headerFile.path.toAbsolutePath().toString().replace("\\", "\\\\"));
         if (!libraryNames.isEmpty()) {
             header.put("libraries", libraryNames.toArray(new String[0]));
             if (libraryPaths != null && !libraryPaths.isEmpty()) {
@@ -168,7 +168,7 @@
             SourceLocation.Location loc = src.getFileLocation();
             Path p = loc.path();
             Map<String, Object> fields = new HashMap<>();
-            fields.put("file", p == null ? "builtin" :  p.toAbsolutePath().toString());
+            fields.put("file", p == null ? "builtin" :  p.toAbsolutePath().toString().replace("\\", "\\\\"));
             fields.put("line", loc.line());
             fields.put("column", loc.column());
             jsb.addAnnotation(align, NATIVE_LOCATION, fields);