neilcsmith-net commented on code in PR #9820:
URL: https://github.com/apache/netbeans/pull/9820#discussion_r4665280018
##########
platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java:
##########
@@ -833,16 +833,30 @@ public static File toFile(FileObject fo) {
return retVal;
}
- /** Finds appropriate java.nio.file.Path to FileObject if possible.
- * If not possible then null is returned.
- * This is the inverse operation of {@link #toFileObject}.
- * @param fo FileObject whose corresponding Path will be looked for
- * @return java.nio.file.Path or null if no corresponding File exists.
+ /** Finds appropriate {@link Path} for given {@code FileObject}.
+ * Since version <em>9.50</em> it is guaranteed that the return value
+ * <em>will never be {@code null}</em> for an object with valid {@link
FileObject#getFileSystem()}.
+ * A fully functional {@link Path}
+ * instance is created even for fully virtual {@code FileObject}s.
+ *
+ * This is the inverse operation of {@link
#toFileObject(java.nio.file.Path) }.
+ * @param fo object to find corresponding Path for
+ * @return {@link Path} for the {@code FileObject} never {@code null}
+ *
* @since 9.32
*/
public static Path toPath(FileObject fo) {
+ Parameters.notNull("fo", fo);
File f = toFile(fo);
Review Comment:
Maybe check for `(Path) fo.getAttribute("java.nio.Path")` first, and make
trivial change to `masterfs` to return directly? Could allow for better
optimization from file system implementations in future and/or option to switch
in nio2 based memory and zip filesystems.
Is conversion via attribute documented?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists