codingkiddo commented on PR #16236:
URL: https://github.com/apache/dubbo/pull/16236#issuecomment-4368156914

   Hi @nilesh-2005 
   
   Thanks for reviewing.
   
   For null input, the existing behavior is preserved because the method uses 
`isNotEmpty(list)`, so null or empty lists are not sorted and are returned 
as-is.
   
   For non-comparable inputs, this PR intentionally moves the failure from 
runtime to compile time by changing the signature to:
   
   ```java
   <T extends Comparable<? super T>>
   ```
   
   So callers passing `List<NonComparableType>` will no longer compile, instead 
of compiling and potentially failing at runtime through `Collections.sort`.
   
   I can add a short JavaDoc clarification if maintainers prefer, for example:
   
   ```java
   /**
    * Sorts the given list according to the natural ordering of its elements.
    * Returns the input list as-is when it is null or empty.
    */
   ```
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to