uranusjr commented on code in PR #75538:
URL: https://github.com/apache/airflow/pull/75538#discussion_r4463846014


##########
java-sdk/processor/src/main/kotlin/org/apache/airflow/sdk/AirflowProcessor.kt:
##########
@@ -787,6 +804,56 @@ class AirflowProcessor : AbstractProcessor() {
       with(processingEnv) { typeUtils.isAssignable(bound, 
elementUtils.getTypeElement(TASK_TYPE.canonicalName()).asType()) }
   }
 
+  /** Returns [owner]'s [Airflow.OnKill] method for the task that [owner] 
declares as [taskId], if [owner] has such a method. */
+  private fun findKillHook(
+    owner: TypeElement,
+    taskId: String,
+  ): ExecutableElement? =
+    owner.enclosedElements
+      .filterIsInstance<ExecutableElement>()
+      .firstOrNull { it.getAnnotation(Airflow.OnKill::class.java)?.task == 
taskId }
+
+  /** Rejects an [Airflow.OnKill] method that takes the wrong parameters, or 
that does not name exactly one task with a body. */
+  private fun checkKillHook(hook: ExecutableElement) {

Review Comment:
   This does not reject a private, static or abstract `@OnKill` method. The 
generated `target.stop()` then fails to compile, with the error pointing at 
generated code. Add checks with a clear message and a processor test.



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