Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Migrate methods that accept File to Path

This PR adds Path-based alternatives to methods that currently only accept File parameters, while keeping existing File-based methods and marking them as deprecated.

Completed:

  • Add Path-based methods to AttributeUtils class
    • getLastModified(Path)
    • chmod(Path, int)
    • getPosixFileAttributes(Path) - deprecated, use Files.readAttributes() directly
    • getFileOwnershipInfo(Path) - deprecated, use Files.getFileAttributeView() directly
  • Add Path-based methods to PlexusIoResourceAttributeUtils class
    • getFileAttributes(Path)
    • getFileAttributes(Path, boolean)
    • getFileAttributesByPath(Path)
    • getFileAttributesByPath(Path, boolean)
    • getFileAttributesByPath(Path, boolean, boolean)
  • Add Path-based methods to SymlinkUtils class
    • readSymbolicLink(Path) - deprecated, use Files.readSymbolicLink() directly
    • createSymbolicLink(Path, Path) - deprecated, use Files.createSymbolicLink() directly
  • Add Path-based constructors and methods to FileAttributes class
    • Constructor with Path parameter
    • uncached(Path) static method
  • Add Path-based methods to ResourceFactory class
    • createResource(Path)
    • createResource(Path, String)
    • createResource(Path, InputStreamTransformer)
  • Add Path-based setters/getters to resource collection classes
    • PlexusIoFileResourceCollection: setBaseDir(Path), getBaseDirAsPath()
    • PlexusIoCompressedFileResourceCollection: setFile(Path), getFileAsPath()
    • AbstractPlexusIoArchiveResourceCollection: setFile(Path), getFileAsPath()
  • Deprecate all existing File-based methods
  • Deprecate simple wrapper methods that don't add value - users should use Java built-in APIs directly
  • File-based methods now reference Java NIO APIs directly in deprecation messages (not deprecated Path methods)
  • Add tests for new Path-based methods
    • AttributeUtils tests
    • SymlinkUtils tests
    • FileAttributes tests
    • PlexusIoResourceAttributeUtils tests
    • ResourceFactory tests
  • Run all tests to ensure backward compatibility (all 63 tests pass)
Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate methods that accept File to Path</issue_title>
<issue_description>Keep existing methods and create similar but with Path as arguments.
Existing mark as deprecated. Some code may be with that also refactored a bit
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Migrate methods that accept File to accept Path Migrate File-based methods to Path API with backward compatibility Nov 8, 2025
Copilot AI requested a review from slachiewicz November 8, 2025 14:33
@slachiewicz

This comment was marked as resolved.

This comment was marked as resolved.

@slachiewicz

This comment was marked as resolved.

This comment was marked as resolved.

@slachiewicz

This comment was marked as resolved.

This comment was marked as off-topic.

@slachiewicz slachiewicz marked this pull request as ready for review November 8, 2025 15:34
@slachiewicz slachiewicz force-pushed the copilot/migrate-file-to-path-methods branch from b9955b8 to 1f6bdc0 Compare November 8, 2025 22:20
@slachiewicz slachiewicz deleted the copilot/migrate-file-to-path-methods branch November 11, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate methods that accept File to Path

1 participant