gnodet commented on code in PR #12702:
URL: https://github.com/apache/maven/pull/12702#discussion_r3792747117
##########
apache-maven/src/assembly/maven/bin/mvn.cmd:
##########
@@ -275,6 +275,8 @@ if "%~1"=="--debug" (
set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenShellCling"
) else if "%~1"=="--up" (
set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenUpCling"
+) else if "%~1"=="--log" (
Review Comment:
**[Medium — Windows parity gap]** The Unix `mvn` script strips routing flags
(`--debug`, `--yjp`, `--enc`, `--shell`, `--up`, `--log`) from `$@` before exec
(lines 316-327), but the Windows `.cmd` passes `%*` unmodified. Running `mvn
--log validate` on Windows will pass `--log` through to Commons CLI, where it
can collide with `--log-file` via prefix matching.
Windows batch's `%*` cannot be modified by `shift`, so equivalent stripping
logic would need a `for` loop to rebuild the argument list.
##########
impl/maven-core/src/main/java/org/apache/maven/DefaultMaven.java:
##########
@@ -660,6 +670,28 @@ private Result<? extends ProjectDependencyGraph>
buildGraph(MavenSession session
return graphResult;
}
+ /**
+ * Converts a compat {@link ModelProblem} to the Maven 4 {@link
BuilderProblem} API,
+ * preserving source, line, column, severity, and message.
+ */
+ private static BuilderProblem toBuilderProblem(ModelProblem problem) {
+ BuilderProblem.Severity severity =
+ switch (problem.getSeverity()) {
+ case FATAL -> BuilderProblem.Severity.FATAL;
+ case ERROR -> BuilderProblem.Severity.ERROR;
+ default -> BuilderProblem.Severity.WARNING;
+ };
+ return BuilderProblem.builder()
+ .source(problem.getSource())
+ .lineNumber(problem.getLineNumber())
+ .columnNumber(problem.getColumnNumber())
+ .exception(problem.getException())
+ .message(problem.getMessage())
+ .severity(severity)
+ .key("model:" + problem.getMessage().hashCode())
Review Comment:
**[Low — Fragile dedup key]** `String.hashCode()` is a 32-bit hash that can
produce collisions (e.g., `"Aa"` and `"BB"` both hash to 2112). If two
different model problems collide, one gets silently deduplicated. Consider
using the full message string or a stronger hash for the key.
--
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]