Pankraz76 commented on code in PR #2425:
URL: https://github.com/apache/maven/pull/2425#discussion_r2125725963


##########
impl/maven-di/src/main/java/org/apache/maven/di/impl/InjectorImpl.java:
##########
@@ -220,7 +220,13 @@ public <Q> Supplier<Q> doGetCompiledBinding(Dependency<Q> 
dep) {
         if (key.getRawType() == List.class) {
             Set<Binding<Object>> res2 = getBindings(key.getTypeParameter(0));
             if (res2 != null) {
-                List<Supplier<Object>> list = 
res2.stream().map(this::compile).collect(Collectors.toList());
+                // Sort bindings by priority (highest first) for deterministic 
ordering
+                List<Binding<Object>> sortedBindings = new ArrayList<>(res2);
+                Comparator<Binding<Object>> comparing = 
Comparator.comparing(Binding::getPriority);
+                sortedBindings.sort(comparing.reversed());

Review Comment:
   might do this, as leaner than implementing comparable. Both better then this 
to avoid exact this situation:
   
   <img width="1155" alt="image" 
src="https://github.com/user-attachments/assets/28619530-9a60-4f42-b345-2492cd2c1968";
 />
   
   DRY DRY DRY 



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to