On 27/12/2017 12:22, Cédric Champeau wrote:
:
1. is the spec saying somewhere that no-one should ever use
`META-INF/services` for something else than a service for `ServiceLoader`?
If not, then ModuleFinder should probably be patched to recognize that
sometimes it's not the case.
The META-INF/services directory has been used for service configuration
files for a long time (I think originally specified in Java SE 1.3).
Adding properties files or other resources in that location may cause
problems for tools and libraries that scan that location.
I haven't read the thread that you linked to but I assume it's about JAR
files on the module path that are treated as automatic modules. In that
case, the relevant part of the ModuleFinder spec is:
"The contents of entries starting with META-INF/services/ are assumed to
be service configuration files (see ServiceLoader). If the name of a
file (that follows META-INF/services/) is a legal class name then it is
assumed to be the fully-qualified class name of a service type. The
entries in the file are assumed to be the fully-qualified class names of
provider classes."
2. the 2d aspect of the question is what Jochen described as "would the
service loader infrastructure let us unload services".
Jochen's mail mentions loading modules dynamically so I assume this
means module layers. If so then unloading is possible and it works well
with services.
-Alan