Summary
VerboseJavaScopeSelector.ScopeComparator orders scopes by indexOf in the fixed list ["compile", "runtime", "provided", "test"]. Any scope not in that list (e.g. system, or a custom scope) returns indexOf == -1 for both operands, so the comparator returns 0 for such pairs and can select the wrong “max” scope. This violates the Comparator contract and can corrupt the REDUCED_SCOPE value recorded on the winning node.
Affected code
src/main/java/org/apache/maven/shared/dependency/graph/internal/VerboseJavaScopeSelector.java:50-57
Suggested fix
Give unknown scopes a deterministic ordering (e.g. treat as lower/least, or fall back to the full known Java scope list including system), and add a test for scopes outside the four listed ones.
Summary
VerboseJavaScopeSelector.ScopeComparatororders scopes byindexOfin the fixed list["compile", "runtime", "provided", "test"]. Any scope not in that list (e.g.system, or a custom scope) returnsindexOf == -1for both operands, so the comparator returns0for such pairs and can select the wrong “max” scope. This violates theComparatorcontract and can corrupt theREDUCED_SCOPEvalue recorded on the winning node.Affected code
src/main/java/org/apache/maven/shared/dependency/graph/internal/VerboseJavaScopeSelector.java:50-57Suggested fix
Give unknown scopes a deterministic ordering (e.g. treat as lower/least, or fall back to the full known Java scope list including
system), and add a test for scopes outside the four listed ones.