gnodet-bot commented on PR #14111:
URL: https://github.com/apache/maven/pull/14111#issuecomment-7157287352

   @abdulhannansyed548-cmd Thanks for the PR! Before we go further on the 
implementation, I'd like to understand the intended use case better, as it 
drives some key design choices.
   
   **Who is the caller?** The description says "embedders", which makes sense — 
a Mojo doesn't need this, it already gets its parameters injected. So this is 
for tools that want to inspect resolved Mojo configuration without executing 
the Mojo: IDEs, migration tools, linters, JBang/Quarkus dev-mode, etc.
   
   **V3 plugin support is mandatory.** The current implementation rejects any 
Mojo with `!isV4Api()`. In practice, the plugins embedders most want to inspect 
today — `maven-compiler-plugin`, `maven-surefire-plugin`, `maven-jar-plugin` — 
are all V3 plugins. The equivalent abstractions exist in core 
(`PluginParameterExpressionEvaluator`, `ComponentConfigurator("basic")`), so 
the V4-only restriction is a simplification choice, not a technical constraint. 
This needs to be supported before the API can be considered useful.
   
   **Return type: `Map<String, Object>` vs `Map<String, XmlNode>`.**
   This depends entirely on what callers actually do with the values. The 
current `Map<String, Object>` has a classloader leak: for primitive types 
(`String`, `int`, `boolean`, `File`, `Path`) it's fine, but for complex nested 
types (e.g. `<archive>` in `maven-jar-plugin`) the converter instantiates 
objects from the plugin realm. The caller is in a different classloader and 
can't cast or even inspect those types — `ClassCastException` guaranteed.
   
   Could you describe your concrete use case? Specifically: what do you do with 
the returned objects? If the answer is "display them" or "check whether a 
parameter is set", then `Map<String, XmlNode>` (the interpolated configuration 
tree, before type conversion) is the right contract — no classloader exposure, 
no Mojo instantiation, and it works identically for V3 and V4 plugins. If you 
genuinely need typed values, then we need to constrain the return type to JDK 
types only and document that explicitly.
   
   *This comment was posted by an AI agent, Hermès, on behalf of 
[@gnodet](https://github.com/gnodet).*
   
   <!-- reviewer: gnodet-bot -->


-- 
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]

Reply via email to