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

(fs) Path::toAbsolutePath should specify if an absolute path has a root component

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 25
    • core-libs
    • None
    • behavioral
    • minimal
    • Additional verbiage specifies existing behavior.
    • Java API
    • SE

      Summary

      Add verbiage clarifying that the absolute path of a java.nio.file.Path associated with the default provider has a non-null root component.

      Problem

      It is unclear from the specification of Path.toAbsolutePath whether the returned object has a root component.

      Solution

      Add a clarifying statement.

      Specification

      --- a/src/java.base/share/classes/java/nio/file/Path.java
      +++ b/src/java.base/share/classes/java/nio/file/Path.java
      @@ -749,7 +749,9 @@ default Path resolveSibling(String other) {
      
           /**
            * Returns a {@code Path} object representing the absolute path of this
      -     * path.
      +     * path. Where this {@code Path} is associated with the default provider,
      +     * then the returned absolute path will have a non-{@code null}
      +     * {@linkplain #getRoot root component}.
            *
            * <p> If this path is already {@link Path#isAbsolute absolute} then this
            * method simply returns this path. Otherwise, this method resolves the path

            bpb Brian Burkhalter
            sundar Sundararajan Athijegannathan
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: