diff --git a/gradle.properties b/gradle.properties index ecb1b127..20a7f2de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true -version=1.1.2 +version=1.1.3 asm_version=9.7 diff --git a/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_FileSystems.java b/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_FileSystems.java index ef561854..c627f644 100644 --- a/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_FileSystems.java +++ b/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_FileSystems.java @@ -8,6 +8,7 @@ import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; +import java.util.HashMap; import java.util.Map; public class J_N_F_FileSystems { @@ -17,6 +18,7 @@ public class J_N_F_FileSystems { @CoverageIgnore @Stub(ref = @Ref("java/nio/file/FileSystems")) public static FileSystem newFileSystem(URI uri, Map env) throws IOException { + env = new HashMap<>(env); env.replaceAll((k, v) -> { if (v instanceof Boolean && !k.equals("useTempFile")) { return v.toString(); @@ -29,6 +31,7 @@ public static FileSystem newFileSystem(URI uri, Map env) throws @CoverageIgnore @Stub(ref = @Ref("java/nio/file/FileSystems")) public static FileSystem newFileSystem(URI uri, Map env, ClassLoader loader) throws IOException { + env = new HashMap<>(env); env.replaceAll((k, v) -> { if (v instanceof Boolean && !k.equals("useTempFile")) { return v.toString(); diff --git a/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_S_FileSystemProvider.java b/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_S_FileSystemProvider.java index 337473d6..8d98c352 100644 --- a/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_S_FileSystemProvider.java +++ b/java-api/src/java12/java/xyz/wagyourtail/jvmdg/j12/stub/java_base/J_N_F_S_FileSystemProvider.java @@ -8,6 +8,7 @@ import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.spi.FileSystemProvider; +import java.util.HashMap; import java.util.Map; public class J_N_F_S_FileSystemProvider { @@ -15,6 +16,7 @@ public class J_N_F_S_FileSystemProvider { @Stub @CoverageIgnore public static FileSystem newFileSystem(FileSystemProvider provider, URI uri, Map env) throws IOException { + env = new HashMap<>(env); env.replaceAll((k, v) -> { if (v instanceof Boolean && !k.equals("useTempFile")) { return v.toString(); @@ -27,6 +29,7 @@ public static FileSystem newFileSystem(FileSystemProvider provider, URI uri, Map @Stub @CoverageIgnore public static FileSystem newFileSystem(FileSystemProvider provider, Path path, Map env) throws IOException { + env = new HashMap<>(env); env.replaceAll((k, v) -> { if (v instanceof Boolean && !k.equals("useTempFile")) { return v.toString(); diff --git a/testing/downgrade/src/main/java/xyz/wagyourtail/downgradetest/TestFile.java b/testing/downgrade/src/main/java/xyz/wagyourtail/downgradetest/TestFile.java index dadbe38f..a046f8b7 100644 --- a/testing/downgrade/src/main/java/xyz/wagyourtail/downgradetest/TestFile.java +++ b/testing/downgrade/src/main/java/xyz/wagyourtail/downgradetest/TestFile.java @@ -5,7 +5,13 @@ import java.io.FileWriter; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; import java.nio.file.Files; +import java.nio.file.StandardOpenOption; +import java.util.Map; + +import static java.nio.file.FileSystems.newFileSystem; public class TestFile { @@ -28,7 +34,15 @@ public static void main(String[] args) throws IOException { } reader.close(); System.out.println(sb.toString()); + + var temp2 = Files.createTempFile("temp", ".zip"); + Files.deleteIfExists(temp2); + try (FileSystem fs = FileSystems.newFileSystem(temp2, Map.of("create", "true"))) { + Files.writeString(fs.getPath("/test.txt"), "Hello World!", StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); + } + Files.deleteIfExists(temp); + Files.deleteIfExists(temp2); } }