Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WELD-2786 OM configurator without overriden notify method should respect Reception settings #2961

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

manovotn
Copy link
Contributor

@manovotn manovotn commented Apr 25, 2024

Reproducer plus a draft of solution for Weld-owned observer methods.

@@ -82,7 +83,11 @@ public ObserverMethodConfiguratorImpl(Extension extension) {
public ObserverMethodConfiguratorImpl(ObserverMethod<T> observerMethod, Extension extension) {
this(extension);
read(observerMethod);
notifyWith(e -> observerMethod.notify(e));
if (observerMethod instanceof ObserverMethodImpl<?, ?>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't very good as it relies on our impl of OM underneath while technically the impl can be arbitrary.
However, I don't think we can achieve this with any other setup anyway as the public API for ObserverMethod doesn't allow us to setReception(). Thoughts or ideas @mkouba?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it's OK because it should only work for configurators which are based on non-synthetic observer methods, i.e. observer methods backed by a Java method of a class bean which is always a Weld implementation of OM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. observer methods backed by a Java method of a class bean which is always a Weld implementation of OM.

That is a good point, thank you.

@manovotn manovotn marked this pull request as ready for review April 26, 2024 14:54
@manovotn manovotn merged commit caacedb into weld:master Apr 26, 2024
16 checks passed
@manovotn manovotn deleted the weld2786 branch April 26, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants