Copilot commented on code in PR #7794:
URL: https://github.com/apache/incubator-seata/pull/7794#discussion_r2679256064
##########
common/src/main/java/org/apache/seata/common/util/ReflectionUtil.java:
##########
@@ -168,6 +169,31 @@ public static Set<Class<?>> getInterfaces(Class<?> clazz) {
return interfaces;
}
+ /**
+ * get all interface of the clazz,include all parent class and all parent
interface
+ * @param clazz
+ * @return
Review Comment:
The comment contains a grammatical error. It should be "get all interfaces
of the clazz, include all parent classes and all parent interfaces" or better
yet "Get all interfaces of the class, including those from parent classes and
parent interfaces".
```suggestion
* Get all interfaces of the class, including those from parent classes
and parent interfaces.
*
* @param clazz the class whose interface hierarchy is to be retrieved
* @return a set containing all interfaces in the class hierarchy
```
##########
common/src/main/java/org/apache/seata/common/util/ReflectionUtil.java:
##########
@@ -705,6 +731,93 @@ 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>
Review Comment:
The javadoc comment is incomplete and doesn't follow the standard javadoc
format. The description is unclear and contains grammatical issues. Parameter
descriptions should use @param tags, and the generic type parameter description
is missing.
```suggestion
* Finds an annotation of the specified type on the given class or, if a
method name is provided,
* on the corresponding method in the class hierarchy.
*
* <p>This method first attempts to locate the annotation at the class
level. If no class-level
* annotation is found and a non-{@code null} method name is provided,
it then searches for the
* annotation on the specified method (including in superclasses, as
determined by the underlying
* helper methods).</p>
*
* @param targetClass the class on which to search for the annotation
* @param methodName the name of the method for method-level
lookup; may be {@code null} to
* restrict the search to class-level annotations
* @param paramTypes the parameter types of the method to match
when searching for a
* method-level annotation
* @param annotationClass the type of annotation to find
* @param <A> the annotation type
* @return the first matching annotation found on the class or method,
or {@code null} if none is found
```
##########
common/src/main/java/org/apache/seata/common/util/ReflectionUtil.java:
##########
@@ -168,6 +169,31 @@ public static Set<Class<?>> getInterfaces(Class<?> clazz) {
return interfaces;
}
+ /**
+ * get all interface of the clazz,include all parent class and all parent
interface
+ * @param clazz
+ * @return
Review Comment:
The javadoc comment is incomplete and doesn't follow the standard javadoc
format. It's missing proper parameter and return value descriptions using
@param and @return tags.
```suggestion
* Get all interfaces implemented by the given class, including
interfaces declared
* on all its superclasses and all their parent interfaces.
*
* @param clazz the class whose full interface hierarchy should be
resolved; may be {@code null}
* @return a set containing all interfaces in the hierarchy of the given
class, or an empty set if {@code clazz} is {@code null}
```
##########
common/src/test/java/org/apache/seata/common/util/ReflectionUtilTest.java:
##########
@@ -512,6 +540,26 @@ static class TestConstants {
public static final String STATIC_FINAL_FIELD = "original";
}
+ interface InterOther {}
+
+ @Deprecated
+ interface InterParent {}
+
+ interface InterSub extends InterParent {}
+
+ interface InterChild extends InterSub {}
+
+ interface InterOther3 {}
+
+ class ClassParent implements InterOther3 {}
+
+ @Deprecated
+ interface InterOther2 {}
+
+ class ClassSub extends ClassParent implements InterOther2 {}
Review Comment:
ClassSub should be made static, since the enclosing instance is not used.
```suggestion
static class ClassParent implements InterOther3 {}
@Deprecated
interface InterOther2 {}
static class ClassSub extends ClassParent implements InterOther2 {}
```
##########
common/src/test/java/org/apache/seata/common/util/ReflectionUtilTest.java:
##########
@@ -512,6 +540,26 @@ static class TestConstants {
public static final String STATIC_FINAL_FIELD = "original";
}
+ interface InterOther {}
+
+ @Deprecated
+ interface InterParent {}
+
+ interface InterSub extends InterParent {}
+
+ interface InterChild extends InterSub {}
+
+ interface InterOther3 {}
+
+ class ClassParent implements InterOther3 {}
+
+ @Deprecated
+ interface InterOther2 {}
+
+ class ClassSub extends ClassParent implements InterOther2 {}
+
+ class ClassChild extends ClassSub implements InterChild, InterOther {}
Review Comment:
ClassChild should be made static, since the enclosing instance is not used.
```suggestion
static class ClassParent implements InterOther3 {}
@Deprecated
interface InterOther2 {}
static class ClassSub extends ClassParent implements InterOther2 {}
static class ClassChild extends ClassSub implements InterChild,
InterOther {}
```
##########
common/src/test/java/org/apache/seata/common/util/ReflectionUtilTest.java:
##########
@@ -512,6 +540,26 @@ static class TestConstants {
public static final String STATIC_FINAL_FIELD = "original";
}
+ interface InterOther {}
+
+ @Deprecated
+ interface InterParent {}
+
+ interface InterSub extends InterParent {}
+
+ interface InterChild extends InterSub {}
+
+ interface InterOther3 {}
+
+ class ClassParent implements InterOther3 {}
+
+ @Deprecated
+ interface InterOther2 {}
+
+ class ClassSub extends ClassParent implements InterOther2 {}
+
+ class ClassChild extends ClassSub implements InterChild, InterOther {}
Review Comment:
ClassParent should be made static, since the enclosing instance is not used.
```suggestion
static class ClassParent implements InterOther3 {}
@Deprecated
interface InterOther2 {}
static class ClassSub extends ClassParent implements InterOther2 {}
static class ClassChild extends ClassSub implements InterChild,
InterOther {}
```
--
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]