GeezerVison is showing github.com — Fix #327: evaluate model collections on Maven 4 by wilx · Pull Request #417 · apache/maven-help-plugin
Conversation
wilx
commented
Aug 9, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fixes #327 for the Maven 4-enabled line.
Maven 4 exposes evaluated model collections through WrapperList and uses immutable collection and map implementations inside the model. XStream does not recognize these implementations and falls back to reflective serialization, which fails when it tries to access JDK internals such as AbstractList.modCount.
This change registers collection and map converters that accept their public interfaces and aliases the concrete runtime list class so the existing XML root name is preserved. The evaluated list is serialized directly without copying it.
The commits are intentionally split: the first adds the regression IT and fails with the WrapperList reflection error; the second applies the fix.
Validation
- Maven 3.10.0-rc-1 / JDK 17
-Prun-its clean verify: all 26 unit tests and all 35 applicable ITs passed; the Maven 4-only regression IT was skipped
- Maven 4.0.0-rc-6 / JDK 21
clean verify: all 26 unit tests passed
- Maven 4.0.0-rc-6 / JDK 21 focused
-Prun-its clean verify: passed
- Maven 4.0.0-rc-6 / JDK 25 focused
-Prun-its clean verify: passed
- Maven 4.0.0-rc-6 / JDK 21 full
clean verify: the new IT passed; two existing Describe ITs failed (describe-cmd-with-goal-report and describe-plugin-without-name)
Checklist
-
This pull request addresses one issue without unrelated changes.
-
The description explains what changed, how, and why.
-
Each commit has a meaningful subject line and body. Commit subjects are meaningful; no commit bodies were added.
-
A regression integration test fails without the runtime change.
-
mvn verify was run successfully.
-
The complete Maven 3 integration-test suite and the focused Maven 4 regression IT were run successfully; unrelated full-suite RC6 failures are documented above.
-
I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004
-
In any other case, an Apache Individual Contributor License Agreement has been filed.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
needs tests
I have added a test case.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Maven 4.0.0-rc-7 this no longer crashes, but help:evaluate -Dexpression=project.build.resources now prints the internal delegate wrapper with InputLocation trees, and verify.groovy asserts that shape. Could you unwrap the delegate (or omit locations) and have the IT check only the user-facing elements?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
Replace JAR entry path separators with dots without inserting regex escapes. Skip package-info metadata during alias discovery to avoid class-loading errors on Maven 4.
Verify short names for model collections, nested delegates, maps, and settings servers.
On Maven 4.0.0-rc-7 this no longer crashes, but help:evaluate -Dexpression=project.build.resources now prints the internal delegate wrapper with InputLocation trees, and verify.groovy asserts that shape. Could you unwrap the delegate (or omit locations) and have the IT check only the user-facing elements?
Fixed. Also, I made a change that restores uses of short names instead of FQCNs in the output.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Flattening the delegate still exposed the API model's immutable collection
implementations as class="org.apache.maven.api.model.ImmutableCollections$List2"
attributes on every collection field, XStream back references to the shared
empty-collection singleton (reference="../includes"), string maps written as
<entry> pairs instead of the Maven 3 <key>value</key> form, and the lazily
populated caches pluginMap, reportSetMap and managementKey whenever an earlier
call had filled them. The mapper now names the immutable collections like the
default implementations, treats them as value types, and skips the caches; a
converter writes the API model's string maps like Properties. Maven 3 output
is unchanged.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 14, 2026
Reviewers
elharo
Awaiting requested review from elharo
Uh oh!
There was an error while loading. Please reload this page.
Labels
bug
Something isn't working
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|