Skip to content

Should recommend Path.of() instead of Paths.get() #303

Open
@Bananeweizen

Description

@Bananeweizen

I appreciate the recent phase out of old java.io.File usage via #301. However, in my eyes the recommended replacement is not good. Paths.get() works fine, but it has a note in its Javadoc which recommends the usage of Path.of() instead, and that's what modernizer should suggest, too: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/nio/file/Paths.java#L36-L38

However, that method is only available from Java 11, therefore there is the tiny window of people updating from 7 to 8 only (instead of from 7 to 11+), which would need Paths.get(). Not sure if that tiny fraction can be ignored, or whether the error message should point to both replacements (one for Java 8, one for Java 11+).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions