gnodet-bot commented on code in PR #13494:
URL: https://github.com/apache/maven/pull/13494#discussion_r4610619708
##########
impl/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java:
##########
@@ -364,4 +488,115 @@ private static Object getId(ClassLoader classLoader) {
}
return classLoader;
}
+
+ private static final String MODULE_ACCESS_DESCRIPTOR =
"META-INF/maven/module-access";
+
+ /**
+ * Reads {@code META-INF/maven/module-access} descriptors from the plugin
realm's classpath and
+ * applies the access directives they contain.
+ *
+ * <h4>Purpose</h4>
+ * <p>
+ * When a plugin (or extension) runs on the <em>classpath</em> (unnamed
module) it may need to
+ * call into packages of a <em>named</em> module that lives in Maven's
boot/runtime layer —
+ * for example JLine modules in {@code lib/modules/}, or any future Maven
API module that ships
Review Comment:
⚠️ **Inaccurate Javadoc — JLine modules are not reachable via this mechanism
after the new commit**
`ClassWorld.findModule()` searches only `world.moduleLayer` (the api layer,
set by the second commit) and `ModuleLayer.boot()`. JLine lives in
`infraLayer`, which is not registered as `world.moduleLayer`. A plugin
declaring `add-opens org.jline.terminal/...=ALL-UNNAMED` will get a `WARNING:
module 'org.jline.terminal' not found` and the directive will be silently
ignored.
Remove the JLine example here and document the actual constraint:
`module-access` targets maven-api-* modules (api layer) and JDK platform
modules (boot layer) only. Infrastructure modules like JLine are intentionally
excluded from plugin visibility — but this needs to be stated, not just implied.
```suggestion
* When a plugin (or extension) runs on the <em>classpath</em> (unnamed
module) it may need to
* call into packages of a <em>named</em> module that lives in Maven's
boot or API layer —
* for example a {@code maven-api-*} module with strong encapsulation,
or a JDK platform module.
* Note: infrastructure modules such as JLine ({@code lib/modules/})
live in the <em>infra layer</em>
* and are intentionally excluded from this mechanism; classpath code
reaches them via the
* ClassLoader delegation chain, not via JPMS {@code add-opens}/{@code
add-exports}.
```
##########
impl/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java:
##########
@@ -364,4 +488,115 @@ private static Object getId(ClassLoader classLoader) {
}
return classLoader;
}
+
+ private static final String MODULE_ACCESS_DESCRIPTOR =
"META-INF/maven/module-access";
+
+ /**
+ * Reads {@code META-INF/maven/module-access} descriptors from the plugin
realm's classpath and
+ * applies the access directives they contain.
+ *
+ * <h4>Purpose</h4>
+ * <p>
+ * When a plugin (or extension) runs on the <em>classpath</em> (unnamed
module) it may need to
+ * call into packages of a <em>named</em> module that lives in Maven's
boot/runtime layer —
+ * for example JLine modules in {@code lib/modules/}, or any future Maven
API module that ships
Review Comment:
⚠️ **Inaccurate Javadoc — JLine modules are not reachable via this mechanism
after the new commit**
`ClassWorld.findModule()` searches only `world.moduleLayer` (the api layer,
set by the second commit) and `ModuleLayer.boot()`. JLine lives in
`infraLayer`, which is not registered as `world.moduleLayer`. A plugin
declaring `add-opens org.jline.terminal/...=ALL-UNNAMED` will get a `WARNING:
module 'org.jline.terminal' not found` and the directive will be silently
ignored.
Remove the JLine example here and document the actual constraint:
`module-access` targets maven-api-* modules (api layer) and JDK platform
modules (boot layer) only. Infrastructure modules like JLine are intentionally
excluded from plugin visibility — but this needs to be stated, not just implied.
```suggestion
* When a plugin (or extension) runs on the <em>classpath</em> (unnamed
module) it may need to
* call into packages of a <em>named</em> module that lives in Maven's
boot or API layer —
* for example a {@code maven-api-*} module with strong encapsulation,
or a JDK platform module.
* Note: infrastructure modules such as JLine ({@code lib/modules/})
live in the <em>infra layer</em>
* and are intentionally excluded from this mechanism; classpath code
reaches them via the
* ClassLoader delegation chain, not via JPMS {@code add-opens}/{@code
add-exports}.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]