8303485: Replacing os.name for operating system customization

Reviewed-by: naoto, erikj, alanb
This commit is contained in:
Roger Riggs 2023-03-27 17:45:20 +00:00
parent 87b314a985
commit 6c3b10fb1d
13 changed files with 371 additions and 114 deletions

View file

@ -63,7 +63,7 @@ import java.util.stream.StreamSupport;
import jdk.internal.access.JavaUtilZipFileAccess;
import jdk.internal.access.JavaUtilJarAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.misc.VM;
import jdk.internal.util.OperatingSystem;
import jdk.internal.perf.PerfCounter;
import jdk.internal.ref.CleanerFactory;
import jdk.internal.vm.annotation.Stable;
@ -1085,8 +1085,6 @@ public class ZipFile implements ZipConstants, Closeable {
}
}
private static boolean isWindows;
static {
SharedSecrets.setJavaUtilZipFileAccess(
new JavaUtilZipFileAccess() {
@ -1133,7 +1131,6 @@ public class ZipFile implements ZipConstants, Closeable {
}
);
isWindows = VM.getSavedProperty("os.name").contains("Windows");
}
private static class Source {
@ -1321,7 +1318,7 @@ public class ZipFile implements ZipConstants, Closeable {
this.zc = zc;
this.key = key;
if (toDelete) {
if (isWindows) {
if (OperatingSystem.isWindows()) {
this.zfile = SharedSecrets.getJavaIORandomAccessFileAccess()
.openAndDelete(key.file, "r");
} else {