xintongsong commented on code in PR #709:
URL: https://github.com/apache/flink-agents/pull/709#discussion_r3321916734


##########
plan/src/main/java/org/apache/flink/agents/plan/AgentPlan.java:
##########
@@ -227,21 +227,56 @@ private void extractActionsFromAgent(Agent agent) throws 
Exception {
 
         // Scan the agent class for methods annotated with @Action
         Class<?> agentClass = agent.getClass();
+        // getDeclaredMethods() skips inherited @Action methods; reject loudly.
+        for (Class<?> parent = agentClass.getSuperclass();
+                parent != null && parent != Agent.class;
+                parent = parent.getSuperclass()) {
+            for (Method inherited : parent.getDeclaredMethods()) {
+                if (inherited.isAnnotationPresent(
+                        org.apache.flink.agents.api.annotation.Action.class)) {
+                    throw new IllegalStateException(
+                            "Inherited @Action '"
+                                    + parent.getName()
+                                    + "#"
+                                    + inherited.getName()
+                                    + "' is not supported; declare on the 
concrete agent.");
+                }
+            }
+        }

Review Comment:
   Ideally, inherited actions should also be included. Given that this issue is 
not introduced by this PR, I'm okay with not fixing it in this PR. We'd better 
create an issue to track and fix this in future.



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