The short answer to your question is no, the absolute path should not have a root component, however, depending on the provider, it may.
If we look at the source code for UnixPath , we will see that, indeed, if it is an absolute path, then it will return the root component, and it will return only the root component if it is an absolute path.
However, there is no requirement that it be implemented in this way. Theoretically, at least it is possible for getRoot () to return something, and for isAbsolute () to return false. In this case, the results are undefined. Or, to put this in the form of a map of truth:
Result of resolve() when: getRoot()==null getRoot()!=null isAbsolute()==true defined defined isAbsolute()==false defined undefined
source share