Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8298658

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Incomplete
    • Icon: P4 P4
    • None
    • None
    • 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.

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

              Created:
              Updated:
              Resolved: