Skip to content

[MNG-6444] Internal code should prefer Path over File #7402

Open

Description

@jira-importer

Robert Scholte opened MNG-6444 and commented

Goal is to replace all 'new File(' appearances with Path / Paths https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html


Issue Links:

  • MNG-6071 GetResource ('/) returns 'null' if build is started with -f

  • MNG-6437 Generic .uri suffix to get the URI representation of any file property
    ("is depended upon by")

Activity

  1. jira-importer commented on Jul 15, 2018

    @jira-importer
    Author

    Robert Scholte commented

    If we don't want to break too much, we'd better require Java 8 so we can use default methods on interfaces

  2. jira-importer commented on Jul 18, 2018

    @jira-importer
    Author

    Michael Osipov commented

    This will fix a lot of issues [email protected] and me recently dicovered. I wouldn't mix Java 8 features with NIO2 because they aren't related.

  3. jira-importer commented on Jul 18, 2018

    @jira-importer
    Author

    Robert Scholte commented

    Quite some interfaces use File, which would mean transforming Path to File (pass it to a method) to Path (and include null-checks). So removing all new File appearances seems too ambitious. With default methods such transformations might become easier. But I agree, let's do a first sweep and replace the obvious improvements.

  4. jira-importer commented on Jul 18, 2018

    @jira-importer
    Author

    Michael Osipov commented

    We can wire all Files away with Maven 4 and maintain minimal necesary compat for a certain release. WDYT?

  5. jira-importer commented on Jul 18, 2018

    @jira-importer
    Author

    Robert Scholte commented

    First things first. Replace most inner File creations, leave public and protected methods/fields as is.

  6. jira-importer commented on Jul 18, 2018

    @jira-importer
    Author

    Michael Osipov commented

    Agreed.

  7. jira-importer commented on Nov 4, 2018

    @jira-importer
    Author

    Tibor Digana commented

    Not sure if users or developers of external plugins would notice a change in internal Maven code with this improvement. Does it include changing e.g. the returned type of the call Artifact.getFile()? Because this would be benefit in the development of external plugins.

  8. jira-importer commented on Nov 5, 2018

    @jira-importer
    Author

    Robert Scholte commented

    Changing the returnType for getFile() would break a a lot of plugins. Since it is an interface, we should add a default method getPath(), but that requires Java 8. That's out of scope for this ticket.

  9. added
    priority:minor
    on Jul 6, 2025
  10. modified the milestones: , 4.x on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenancepriority:minor

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions