Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Allow adding module imports to JDK modules #5995

Open
FroMage opened this issue Feb 12, 2016 · 5 comments
Open

Allow adding module imports to JDK modules #5995

FroMage opened this issue Feb 12, 2016 · 5 comments

Comments

@FroMage
Copy link
Contributor

FroMage commented Feb 12, 2016

http://stackoverflow.com/questions/35351848/jimfs-path-to-ceylon-directory shows that we need to be able to add a module import to the JDK. In this case FileSystems uses the system class loader to load file-system providers via the JDK service API, but it does not find the jimfs module because it doesn't "see" it.

Although we can create a FileSystem by giving a ClassLoader, which is how this jimFs gets created, the ceylon.file uses URI Paths.get(String) which does not allow us to specify the ClassLoader and so we're left with having to make this provider visible to the JDK.

This is tricky for JBoss modules because I don't think we have influence over the system ClassLoader. This is differently tricky for the --flat-classpath option because the JDK is not in the URLClassLoader that flatly contains all the Ceylon modules.

We have to check how Jigsaw handles this issue as they'll have the exact same problem.

@FroMage
Copy link
Contributor Author

FroMage commented Feb 12, 2016

@dmlloyd: any idea how we can make the JDK view/read a module from JBoss modules?

@dmlloyd
Copy link

dmlloyd commented Feb 12, 2016

Easiest short-term answer would probably be to stuff the java.nio.file.spi.FileSystemProvider#installedProviders field with a new list of providers which includes the one(s) you want to add.

I can see a way to enhance JBoss Modules to support pluggable filesystem providers in the same manner that it supports pluggable URL handlers and etc. If you're interested in having this done, please file a JIRA into the JBoss Modules project.

@FroMage
Copy link
Contributor Author

FroMage commented Feb 12, 2016

Thanks for your answer.

stuff the java.nio.file.spi.FileSystemProvider#installedProviders field with a new list of providers

Using reflection I assume?

support pluggable filesystem providers in the same manner that it supports pluggable URL handlers and etc.

Is that documented anywhere? I'm curious how it's done?

@dmlloyd
Copy link

dmlloyd commented Feb 12, 2016

Using reflection I assume?

Oh yes. :)

Is that documented anywhere? I'm curious how it's done?

No, I'd have to resort to some dirty tricks probably. But at least then it would be my problem and not yours. ;-)

@FroMage
Copy link
Contributor Author

FroMage commented Feb 12, 2016

Indeed I prefer making it your problem ;)

It sounds like the problem is very related to what in Jigsaw would be solved by adding "reads" from the JDK module to the provider module. FileSystem use the Java services pattern, so any solution that solves providing the JDK with access to services (and the related ClassLoader I think) would be generic and solve many issues. If you don't have something like that yet, I'll file an issue.

@FroMage FroMage modified the milestones: 1.2.2, 1.2.3 Feb 18, 2016
@quintesse quintesse modified the milestones: 1.3, 1.2.3 Jul 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants