(fs) Platform-specific type leaks to platform independent code

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Incomplete
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs
    • None

      This is more than a cosmetic issue.
      sun.nio.fs.DefaultFileSystemProvider#instance() leaks the platform-dependent type to platform-independent code.

      Currently, callers of sun.nio.fs.DefaultFileSystemProvider#instance() must issue calls with different signatures on every OS because the target method signature needlessly use {Linux|Windows|Aix|MacOSX}FileSystemProvider, instead of the common FileSystemProvider type.

      For example, java.nio.file.FileSystems.DefaultFileSystemHolder#getDefaultProvider() generates different bytecodes (INVOKESTATIC with different signatures) on every OS.

      We stumbled upon this leakage while working on Espresso (a spec-compliant JVM written in Java, part of the GraalVM project), where we provide an alternative file system to overcome the deprecation of the SecurityManager.

      While we have a workaround in Espresso, a tiny cleanup upstream is desirable.

      These are internal APIs, there's no risk of breakage of any user code.

            Assignee:
            Unassigned
            Reporter:
            Alfonso Alfonso Peterssen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: