Repository navigation
Conversation
9e83359 to
7e19fd5
Compare
Convert multi-value Strings into a comma-separated String of org.apache.maven.plugin.descriptor.Parameter#defaultValue The underlying Sisu implementaton supports comma separated Strings for collections (https://eclipse.dev/sisu/org.eclipse.sisu.plexus/configuration.html#Collection_Objects). as well as the Maven 4 equivalent at V4MojoConfigurator.class. The old single-value defaultValue is still supported, but for multi-value defaults, use defaultValues instead. This closes #1272
7e19fd5 to
bccf6f7
Compare
gnodet-bot
left a comment
There was a problem hiding this comment.
Verdict: COMMENT — Functionally sound enhancement. The null-based mutual-exclusion logic is correct (ASM only visits explicitly-set annotation attributes, so ParameterAnnotationContent fields default to null for unspecified attributes — the conflict check works correctly even with the annotation interface defaults of "" and {}). Two observations worth addressing:
This review was generated by an AI agent, Hermès on behalf of @gnodet.
| /** | ||
| * Default values concatenated with commas in the generated plugin descriptor. | ||
| * Each String value has the format outlined in {@link #defaultValue()}. | ||
| * Multiple values are only supported for collection or array parameters. An empty array specifies no default. |
There was a problem hiding this comment.
String.join(",", defaultValues) is used without escaping, a value like "a,b" would produce an ambiguous descriptor entry that gets split into two values when parsed. Consider adding:
| * Multiple values are only supported for collection or array parameters. An empty array specifies no default. | |
| * Default values concatenated with commas in the generated plugin descriptor. | |
| * Each String value has the format outlined in {@link #defaultValue()}. | |
| * Individual values must not contain commas (the separator character). | |
| * Multiple values are only supported for collection or array parameters. An empty array specifies no default. |
| static boolean isCollection(String className) { | ||
| return className.endsWith("Collection") | ||
| || className.endsWith("List") | ||
| || className.endsWith("Set") | ||
| || className.endsWith("[]"); |
There was a problem hiding this comment.
💡 isCollection() is missing Queue and Deque subtypes. The heuristic currently checks Collection, List, Set, and [], but Queue and Deque (and their common implementations like ArrayDeque, LinkedList when used as Deque) are also valid collection types in Mojo parameters. Consider:
| static boolean isCollection(String className) { | |
| return className.endsWith("Collection") | |
| || className.endsWith("List") | |
| || className.endsWith("Set") | |
| || className.endsWith("[]"); | |
| static boolean isCollection(String className) { | |
| return className.endsWith("Collection") | |
| || className.endsWith("List") | |
| || className.endsWith("Set") | |
| || className.endsWith("Queue") | |
| || className.endsWith("Deque") | |
| || className.endsWith("[]"); | |
| } |
The Javadoc already notes "this is just a heuristic" — worth extending while the method is being added.
Convert multi-value Strings into a comma-separated String of org.apache.maven.plugin.descriptor.Parameter#defaultValue
The underlying Sisu implementaton supports comma separated Strings for collections
(https://eclipse.dev/sisu/org.eclipse.sisu.plexus/configuration.html#Collection_Objects). as well as the Maven 4 equivalent at V4MojoConfigurator.class.
This closes #1272
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
check one of the following: