From b22d39139b97ca0a53c79feaf9758c53986fc37e Mon Sep 17 00:00:00 2001
From: Matej Novotny
Date: Wed, 8 Dec 2021 11:42:56 +0100
Subject: [PATCH] Add default implementation of OM#getDeclaringBean()
---
.../jakarta/enterprise/inject/spi/ObserverMethod.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/api/src/main/java/jakarta/enterprise/inject/spi/ObserverMethod.java b/api/src/main/java/jakarta/enterprise/inject/spi/ObserverMethod.java
index 228cca34..56e92f94 100644
--- a/api/src/main/java/jakarta/enterprise/inject/spi/ObserverMethod.java
+++ b/api/src/main/java/jakarta/enterprise/inject/spi/ObserverMethod.java
@@ -61,9 +61,16 @@ public interface ObserverMethod extends Prioritized {
* For synthetic observers, the return value is undefined.
*
*
+ *
+ * For the sake of compatibility with existing custom {@link ObserverMethod} implementations, this method by default
+ * returns {@code null}.
+ *
+ *
* @return the declaring {@linkplain Bean bean}
*/
- public Bean> getDeclaringBean();
+ default Bean> getDeclaringBean() {
+ return null;
+ }
/**
* Obtains the {@linkplain jakarta.enterprise.event observed event type}.