-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] java.nio.file.FileSystemNotFoundException: Provider "mem" not installed
#315
Comments
Thanks for reporting this bug! I tried replicating the issue, but it seems to be working fine on my machine (Java 17, Windows), https://github.com/Pante/elementary/blob/fix/issue/315/elementary/src/test/java/com/test/Issue315Test.java. I assume the code snippet you provided was part of an annotation processor under test using the Could you provide which Java version, Elementary version & OS you were using? |
@holly-cummins bump! |
Thanks for the follow-up, @Pante. I'm using Java 17, Elementary 2.0.1, and MacOS. I've created a simple reproducer which shows the problem at https://github.com/holly-cummins/elementary-315-reproducer/commits/main/. The first commit reproduces the error. Checking it out and doing
The second commit has a simple file provider to get the tests passing. |
Thanks for taking the time & effort to provide a reproducer. I took a look it and it and I can replicate the issue across both my Windows and MacOS machines. The problem now lies in how to fix it. I'm a little hesitant to continue down the in-memory file representation path as it seems like significant effort to get it working without subtle bugs, even libraries like https://github.com/google/jimfs and https://github.com/marschall/memoryfilesystem seem to contain a long list of caveats. I think this issue even existing is proof of that. I've been thinking and perhaps it might make more sense to lean into temporary directories instead, maybe something similar to https://junit.org/junit5/docs/5.9.1/api/org.junit.jupiter.api/org/junit/jupiter/api/io/TempDir.html? It should be simpler to maintain and also has the upside of allowing people to debug the generated files. |
@holly-cummins I've released Elementary 3 that generates files in temporary directories instead of in-memory. It should fix the split-brain and file system issues. Please do re-open this issue if the bug persists. |
Thanks @Pante, that's worked! I had to change my tests to read |
While moving Elementary away from in-memory files, I remember fixing an issue with |
Describe the bug
If an extension processor calls
toURI
on aFileObject
, aFileSystemNotFoundException
is thrown.To Reproduce
Code like the following, in an extension processor under test, will show the problem:
A
java.nio.file.FileSystemNotFoundException: Provider "mem" not installed
exception will be thrown.I'm able to work around the problem by writing a custom file system, and a custom file system provider, and registering it with the service loader:
However, it's
(a) a lot of boilerplate just to write some annotation processor tests; it feels like the Elementary codebase would be a more logical place for this test infrastructure code.
(b) not actually connected to the in-memory files created by the Elementary
Filer
. So far, nothing broke because of that, but it would be better if themem:
scheme didn't have a split-brain.The text was updated successfully, but these errors were encountered: