Q
: I have heard the term
module graph used in discussions of modules. What
does it mean?
A
: During compilation, the compiler resolves the dependence relationships
between modules by creating a module graph that represents the dependences. The
process ensures that
all dependences are resolved, including those that occur
indirectly. For example, if module A requires module B and B requires module C,
then the module graph will contain module C even if A does not use it directly.
Module graphs can be depicted visually in a drawing to illustrate the relationship
between modules, and you will likely encounter one as you continue on in Java.
Here is a simple example. It is the graph for the first module example in this
chapter. (Because java.base is automatically included, it is not shown in the
diagram.)
In Java, the arrows point from the dependent module to the required module.
Thus, a drawing of a module graph depicts what modules have access to what other
modules. Frankly, only the smallest applications can have their module graphs
visually represented because of the complexity typically involved in many
commercial applications.
Dostları ilə paylaş: