On 5/9/2017 3:04 PM, Ralph Goers wrote:
Pardon me for being dense, but my reading said that Java modules disallowed runtime cycles as well as compile time. Once LoggerFinder binds with the module that provides that service does that not create a runtime dependency? I don’t recall seeing anything describing what the behavior of that is.
The module system disallows cycles in the 'requires' directives of module declarations. The module system allows cycles in the "reads" relation of run-time modules.
When java.base 'uses LoggerFinder;' and invokes ServiceLoader to find providers, there is indeed a "reads" cycle created between the provider module and java.base. ServiceLoader is not special in creating this cycle -- you can create them yourself with the two addReads methods in the API, and all automatic modules have cyclic readability. But there is no 'requires' cycle.
Alex