funky-eyes commented on code in PR #7794:
URL: https://github.com/apache/incubator-seata/pull/7794#discussion_r2558358300
##########
common/src/main/java/org/apache/seata/common/util/ReflectionUtil.java:
##########
@@ -705,6 +705,45 @@ public static Map<String, Object>
getAnnotationValues(Annotation annotation) thr
return getFieldValue(h, "memberValues");
}
+ /**
+ *
+ * @param targetClass the target class
+ * @param methodName the method name
+ * @param paramTypes the param types
+ * @param annotationClass the annotation class
+ * @return the annotation
+ * @param <A>
+ */
+ public static <A extends Annotation> A findAnnotationInHierarchy(
+ Class<?> targetClass, String methodName, Class<?>[] paramTypes,
Class<A> annotationClass) {
+ Class<?> superClass = targetClass.getSuperclass();
+ while (superClass != null && superClass != Object.class) {
+ try {
+ Method superMethod = superClass.getDeclaredMethod(methodName,
paramTypes);
Review Comment:
Should we attempt to read the annotation from the superclass instead of only
checking the method itself?
--
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]