You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/05/27 13:04:48 UTC

[GitHub] [maven-shared-utils] michael-o commented on a change in pull request #35: [MSHARED-893] deprecate file methods we don't need in Java 7+

michael-o commented on a change in pull request #35:
URL: https://github.com/apache/maven-shared-utils/pull/35#discussion_r431100199



##########
File path: src/main/java/org/apache/maven/shared/utils/io/FileUtils.java
##########
@@ -161,47 +161,52 @@ protected FileUtils()
      * Returns the directory path portion of a file specification string.
      * Matches the equally named unix command.
      *
-     * @param filename the file path
+     * @param path the file path
      * @return the directory portion excluding the ending file separator
+     * @deprecated use {@code Paths.get(path).getParent().getName()}
      */
-    @Nonnull public static String dirname( @Nonnull String filename )
+    @Deprecated
+    @Nonnull public static String dirname( @Nonnull String path )

Review comment:
       This hunk is especially great because from a filename you cannot derive a dirname.

##########
File path: src/main/java/org/apache/maven/shared/utils/io/FileUtils.java
##########
@@ -161,47 +161,52 @@ protected FileUtils()
      * Returns the directory path portion of a file specification string.
      * Matches the equally named unix command.
      *
-     * @param filename the file path
+     * @param path the file path
      * @return the directory portion excluding the ending file separator
+     * @deprecated use {@code Paths.get(path).getParent().getName()}

Review comment:
       Does this advise also work when the path is relative? Haven't tested.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org