JDK-8223197 : Release Note: Added FileSystems.newFileSystem(Path, Map<String, ?>) Method
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 13
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2019-05-01
  • Updated: 2019-08-09
  • Resolved: 2019-07-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13Resolved
Description
Three new methods have been added to `java.nio.file.FileSystems` to make it easier to use file system providers that treat the contents of a file as a file system.

- `newFileSystem(Path)`
- `newFileSystem(Path, Map<String, ?>)`
- `newFileSystem(Path, Map<String, ?>, ClassLoader)`

The addition of `newFileSystem(Path, Map<String, ?>)` creates a source (but not binary) compatibility issue for code that has been using the existing 2-arg `newFileSystem(Path, ClassLoader)` and specifying the class loader as `null.` For example, the following cannot be compiled because the reference to `newFileSystem` is ambiguous:

`FileSystem fs = FileSystems.newFileSystem(path, null);`

To avoid the ambiguous reference, this code needs to be modified to cast the second parameter to `java.lang.ClassLoader`.