Windows: all JNI methods verify their path arg.

Also remove the GetAttributesOfMaybeMissingFile
method because it's based on a false belief,
namely that FindFirstFile returns up-to-date
information. According to this OldNewThing post
that belief was wrong: https://blogs.msdn.microsoft.com/oldnewthing/20111226-00/?p=8813

This PR is a follow-up to https://github.com/bazelbuild/bazel/pull/7176

Closes #7178.

PiperOrigin-RevId: 230705273
diff --git a/src/test/java/com/google/devtools/build/lib/windows/WindowsFileOperationsTest.java b/src/test/java/com/google/devtools/build/lib/windows/WindowsFileOperationsTest.java
index 2f7483a..c5a50d3 100644
--- a/src/test/java/com/google/devtools/build/lib/windows/WindowsFileOperationsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/windows/WindowsFileOperationsTest.java
@@ -90,29 +90,29 @@
 
     testUtil.createJunctions(junctions);
 
-    assertThat(WindowsFileOperations.isJunction(root + "/shrtpath/a")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/shrtpath/b")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/shrtpath/c")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/longlinkpath/a")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/longlinkpath/b")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/longlinkpath/c")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/longli~1/a")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/longli~1/b")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/longli~1/c")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/abbreviated/a")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/abbreviated/b")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/abbreviated/c")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/abbrev~1/a")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/abbrev~1/b")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/abbrev~1/c")).isTrue();
-    assertThat(WindowsFileOperations.isJunction(root + "/control/a")).isFalse();
-    assertThat(WindowsFileOperations.isJunction(root + "/control/b")).isFalse();
-    assertThat(WindowsFileOperations.isJunction(root + "/control/c")).isFalse();
-    assertThat(WindowsFileOperations.isJunction(root + "/shrttrgt/file1.txt")).isFalse();
-    assertThat(WindowsFileOperations.isJunction(root + "/longtargetpath/file2.txt")).isFalse();
-    assertThat(WindowsFileOperations.isJunction(root + "/longta~1/file2.txt")).isFalse();
+    assertThat(WindowsFileOperations.isJunction(root + "\\shrtpath\\a")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\shrtpath\\b")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\shrtpath\\c")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longlinkpath\\a")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longlinkpath\\b")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longlinkpath\\c")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longli~1\\a")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longli~1\\b")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longli~1\\c")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\abbreviated\\a")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\abbreviated\\b")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\abbreviated\\c")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\abbrev~1\\a")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\abbrev~1\\b")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\abbrev~1\\c")).isTrue();
+    assertThat(WindowsFileOperations.isJunction(root + "\\control\\a")).isFalse();
+    assertThat(WindowsFileOperations.isJunction(root + "\\control\\b")).isFalse();
+    assertThat(WindowsFileOperations.isJunction(root + "\\control\\c")).isFalse();
+    assertThat(WindowsFileOperations.isJunction(root + "\\shrttrgt\\file1.txt")).isFalse();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longtargetpath\\file2.txt")).isFalse();
+    assertThat(WindowsFileOperations.isJunction(root + "\\longta~1\\file2.txt")).isFalse();
     try {
-      WindowsFileOperations.isJunction(root + "/non-existent");
+      WindowsFileOperations.isJunction(root + "\\non-existent");
       fail("expected to throw");
     } catch (IOException e) {
       assertThat(e.getMessage()).contains("nativeIsJunction");
@@ -215,8 +215,8 @@
     assertThat(helloFile.exists()).isTrue();
     assertThat(new File(longPath).exists()).isTrue();
     assertThat(new File(shortPath).exists()).isTrue();
-    assertThat(WindowsFileOperations.getLongPath(longPath)).endsWith("will.exist\\helloworld.txt");
-    assertThat(WindowsFileOperations.getLongPath(shortPath)).endsWith("will.exist\\helloworld.txt");
+    assertThat(WindowsFileOperations.getLongPath(longPath)).endsWith("will.exist/helloworld.txt");
+    assertThat(WindowsFileOperations.getLongPath(shortPath)).endsWith("will.exist/helloworld.txt");
 
     // Delete the file and the directory, assert that long path resolution fails for them.
     assertThat(helloFile.delete()).isTrue();
@@ -243,9 +243,9 @@
             .toFile();
     assertThat(new File(shortPath).exists()).isTrue();
     assertThat(WindowsFileOperations.getLongPath(shortPath))
-        .endsWith("will.exist_again\\hellowelt.txt");
+        .endsWith("will.exist_again/hellowelt.txt");
     assertThat(WindowsFileOperations.getLongPath(foo + "\\will.exist_again\\hellowelt.txt"))
-        .endsWith("will.exist_again\\hellowelt.txt");
+        .endsWith("will.exist_again/hellowelt.txt");
     try {
       WindowsFileOperations.getLongPath(longPath);
       fail("expected to throw");