ecki commented on code in PR #1512:
URL: https://github.com/apache/commons-lang/pull/1512#discussion_r2597075360


##########
src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java:
##########
@@ -225,31 +225,46 @@ public static int reflectionCompare(final Object lhs, 
final Object rhs, final bo
      * @since 2.2 (2.0 as {@code reflectionCompare(Object, Object, boolean, 
Class)})
      */
     public static int reflectionCompare(
-        final Object lhs,
-        final Object rhs,
-        final boolean compareTransients,
-        final Class<?> reflectUpToClass,
-        final String... excludeFields) {
+    final Object lhs,
+    final Object rhs,
+    final boolean compareTransients,
+    final Class<?> reflectUpToClass,
+    final String... excludeFields) {
 
-        if (lhs == rhs) {
-            return 0;
-        }
-        Objects.requireNonNull(lhs, "lhs");
-        Objects.requireNonNull(rhs, "rhs");
+    if (lhs == rhs) {
+        return 0;
+    }
+    
+    return internalReflectionCompare(lhs, rhs, compareTransients, 
reflectUpToClass, excludeFields);
+}
 
-        Class<?> lhsClazz = lhs.getClass();
-        if (!lhsClazz.isInstance(rhs)) {
-            throw new ClassCastException();
-        }
-        final CompareToBuilder compareToBuilder = new CompareToBuilder();
+// Extracted helper to keep reflectionCompare short and readable
+private static int internalReflectionCompare(

Review Comment:
   I don’t think introducing an internal method which is used in a single place 
does improve anything, not method length, not readability and certainly not 
separation of concerns (what concerns?)



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

Reply via email to