Extended Attributes Support (Linux/macOS)

Sebastian Stenzel sebastian.stenzel at gmail.com
Thu May 8 19:08:53 UTC 2025


Hi all,

A couple of releases ago I added some UserDefinedAttributeView support on macOS and did some cleanup and deduplications [1]. One thing has been bothering me since, though:

I’d like to add a new FileAttributeView named „xattr“ that basically is the same as UnixUserDefinedFileAttributeView [2] but without the „user.“ prefix, so it can be used to access extended attributes set by other applications.

This shouldn’t require many code additions, just some clever class hierarchy modifications. I.e. UnixUserDefinedFileAttributeView should extend ExtendedFileAttributeView. To achieve this, I propose to replace sun.nio.fs.AbstractUserDefinedFileAttributeView with an interface with default methods (now that the security manager is gone).

This isn’t public API, nevertheless I’d like to know if this would be an acceptable change or if you’d rather like me to use composition over inheritance.

Any thoughts?

Sebastian


[1] https://github.com/openjdk/jdk/pulls?q=is%3Apr+author%3Aoverheadhunter+xattr+
[2] https://github.com/openjdk/jdk/blob/jdk-24%2B36/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/nio-dev/attachments/20250508/0a21c385/attachment.htm>


More information about the nio-dev mailing list