LI123456mo opened a new pull request, #16006:
URL: https://github.com/apache/dubbo/pull/16006

   Context
   Currently, org.apache.dubbo.common.utils.MethodComparator lacks unit test 
coverage. This utility is critical for ensuring a consistent and deterministic 
ordering of methods, which is often required for stable service exports and 
metadata generation in Dubbo.
   
   Changes
   Created MethodComparatorTest.java to fully validate the comparison logic. 
The tests cover the following sorting priority:
   
   Identity Check: Uses m1.equals(m2) to return 0 immediately for identical 
method instances.
   
   Rule 1 (Method Name): Compares method names lexicographically (e.g., find() 
< list()).
   
   Rule 2 (Parameter Count): If names are identical, the method with fewer 
parameters comes first.
   
   Rule 3 (Parameter Type Name): If names and counts are identical, compares 
the fully qualified names of the parameter types (e.g., int < java.lang.String).
   
   Verification Results
   Test Environment: Windows / Java / Maven.
   
   Command Run: mvn clean test -Dtest=MethodComparatorTest -pl dubbo-common
   
   Result: BUILD SUCCESS
   
   Style: Code formatted using mvn spotless:apply.


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