Runtime vs . compile time cyclic dep was: Jigsaw prototype, take 2

Jaroslav Tulach jaroslav.tulach at
Sun Sep 8 11:43:20 PDT 2013

Dne Ne 8. září 2013 11:32:44, David M. Lloyd napsal(a):
> > Fundamentally, if you are developing two things, and there is a circular
> > dependency between them, you do not have *two* things - you have one thing
> > which you enjoy pretending is two.  If neither can exist without the
> > other,
> > their independence is in illusion.
> Our experiences with JBoss Modules has shown that there's a significant
> difference between cyclic dependencies at compile time and at run time.
>   At run time, it is often convenient (for various reasons) to add an
> implementation to its corresponding API's import list.  In fact whenever
> a class loader is used as a reference or start point for loading things
> (particularly via ServiceLoader and its kin), it is useful to be able to
> tie things together this way.

Hello David,
just to make sure I understand. There is no cyclic depenedency during compile 
time, yet there may be a cyclic dependency during runtime. That must mean one 
of the modules is using Class.forName(...) and you want it to succeed, right?

Such kind of runtime cyclic dependency is certainly OK. We use it in NetBeans 
(via ServiceLoader-like approach) and Jigsaw was supposed to support it via 
"require service" as well.


PS: Using Class.forName(...) to have a runtime cyclic dependency is possible 
in NetBeans as well, but we try to avoid it as it involves mangling with 
classloaders (in our case), which is a bit too low-level...

More information about the jigsaw-dev mailing list