nva commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2815915492


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/FieldAccessor.java:
##########
@@ -135,6 +135,23 @@ static FieldAccessor create(
         }
     }
 
+    /**
+     * Gets an accessible field by name of the given class and its parents (if 
any).
+     */
+    private static Field getField(Class<?> clazz, String fieldName) throws 
NoSuchFieldException {
+        var current = clazz;
+        while (current != null) {
+            try {
+                return current.getDeclaredField(fieldName);

Review Comment:
   It will call `getDeclaredField` on `Object.class` before throwing a 
'NoSuchFieldException'.



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/FieldAccessor.java:
##########
@@ -135,6 +135,23 @@ static FieldAccessor create(
         }
     }
 
+    /**
+     * Gets an accessible field by name of the given class and its parents (if 
any).
+     */
+    private static Field getField(Class<?> clazz, String fieldName) throws 
NoSuchFieldException {
+        var current = clazz;
+        while (current != null) {
+            try {
+                return current.getDeclaredField(fieldName);
+            } catch (NoSuchFieldException ignored) {
+                // ignore
+            }
+
+            current = current.getSuperclass();
+        }
+        throw new NoSuchFieldException(fieldName);

Review Comment:
   Does it make sense to add a class name to an exception?



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