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

Retire the system properties sun.io.useCanonCaches and sun.io.useCanonPrefixCache

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • core-libs
    • None
    • behavioral
    • minimal
    • Clients may have activated the cache and if so, the removal of the cache would make their code slower and more correct.
    • System or security property
    • JDK

      Summary

      Retire the system properties sun.io.useCanonCaches and sun.io.useCanonPrefixCache and the underlying internal java.io.ExpiringCache class.

      Problem

      java.io.File has a cache of canonical paths and part paths to help the performance of the File::getCanonicalFile and File::File::getCanonicalPath. The cache was introduced in JDK 1.4.x to help the startup of Applets and Java Web Start applications running with a security manager. These types of applications are not relevant to JDK 9 or newer releases. Furthermore, java.io.FilePermission was changed in JDK 9 to no longer need the canonical path so this removes must of the original motivation for the cache for the few remaining applications that run with a security manager.

      The cache has correctness issues that arise when files are changed or when symbolic files are added to removed. The cache was disabled in JDK 12. It is time to finally remove it.

      Solution

      Drop the cache and the following two system properties:

      • sun.io.useCanonCaches
      • sun.io.useCanonPrefixCache

      Specification

      No specification changes, the system properties (and the caching mechanism) were never documented in an implNote.

      A release note will be added.

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: