ResolvedModule、Module 和 Observable Module 有什么区别

What is the difference between ResolvedModule, Module and Observable Module

以下每个状态的文档:

ResolvedModule

A module in a graph of resolved modules. ResolvedModule defines the configuration method to get the configuration that the resolved module is in. It defines the reference method to get the reference to the module's content.

Module

Represents a run-time module, either named or unnamed.

问:- 这两者什么时候不同,是在编译和 运行 时,还是只是模块的不同表示?

另一方面,the module-path 定义

The modules built-in to the compile-time or run-time environment, together with those defined by artifacts on the module path, are collectively referred to as the universe of observable modules.

问:- 所有这些都相关吗?有人可以举例说明如何以及在什么时候解释这个概念吗?

如果您正在寻找描述这些特定用法的答案 类,我无法理解,但这是这些术语在技术性稍差的上下文中的含义:

  • 模块:通俗地用于描述任何模块化工件(模块化 JAR 或 JMOD)
  • Observable Module: 运行时映像中的模块或模块路径上的模块
  • Resolved Module: 在模块解析期间添加到模块图中的可观察模块

从指定分辨率的 java.lang.module 包描述开始,您将了解可读性和可读性图表。

然后看一下Configuration class作为Configuration对象封装了一个可读性图。图中的每个顶点都由 ResolvedModule.

表示

一旦有了配置,就可以考虑将其实例化为 Java 虚拟机中的模块图。这将导致您 java.lang.ModuleLayer API.

我认为问题的一部分是询问模型世界 ResolvedModule 和 运行 时间 Module 之间是否存在 1-1 关系。通常是的,但是没有什么可以阻止您多次实例化配置,这将导致从同一配置创建多个模块层。

现在想的​​可能太多了,最好消化一下设计然后API再去那里。