Skip to content

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Dec 31, 2025

  • Using Files.list in readdir avoids an extra stat per file on Windows.
  • Use checkAccess directly in the is{Readable,Writable,Executable} methods to make it more obvious that they distinguish between failure to get the metadata and the file not being accessible. This is what File.is* does under the hood anyway. Also ensure that non-executable parent directories are handled correctly for all methods and avoid an extra stat in case the file exists and has the queried property.
  • Overriding setWritable avoids another stat.

Related to #23729 since it removes some usages of getIoFile().

This is a pure refactoring that prepares for solutions to bazelbuild#23729.
@fmeum fmeum force-pushed the 23729-java-fs-nio branch 3 times, most recently from 0706f17 to 3d78a04 Compare December 31, 2025 15:00
@fmeum fmeum changed the title Use more NIO in JavaIoFileSystem Use more NIO on Windows Dec 31, 2025
@fmeum fmeum force-pushed the 23729-java-fs-nio branch 2 times, most recently from 753127d to a8658ae Compare December 31, 2025 17:01
* Using `Files.list` in `readdir` avoids an extra stat per file.
* Use `checkAccess` directly in the `is{Readable,Writable,Executable}` methods to make it more obvious that they distinguish between failure to get the metadata and the file not being accessible. This is what `File.is*` does under the hood anyway.

Also delete an unused method and explicitly annotate `getNioPath` and `getIoFile` overrides to not return null as their base definition may.
# Conflicts:
#	src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java
@fmeum fmeum force-pushed the 23729-java-fs-nio branch 5 times, most recently from a1a7f2e to 5e65600 Compare January 1, 2026 17:59
@fmeum fmeum force-pushed the 23729-java-fs-nio branch from 16e8258 to 76441ed Compare January 1, 2026 18:41
@fmeum fmeum force-pushed the 23729-java-fs-nio branch from 191b2ba to 4f8c00d Compare January 1, 2026 22:12
@fmeum fmeum force-pushed the 23729-java-fs-nio branch from f5c87e0 to 1f32cbf Compare January 2, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant