-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ArC: fix the situation when a framework bean uses an application decorator #43245
ArC: fix the situation when a framework bean uses an application decorator #43245
Conversation
…rator ArC-generated classes for framework beans are by default _not_ application classes. This causes problems in hierarchical classloader environments (dev/test mode) when there is an application decorator that applies to the framework bean. This commit fixes that issue by turning the ArC-generated classes for framework beans into application classes whenever an application decorator applies. This makes package access impossible, which is an unfortunate downside. The problem doesn't exist in a flat classloading environment, such as prod mode.
I couldn't figure out a better solution. I tried turning all |
Status for workflow
|
🎊 PR Preview 62039a3 has been successfully built and deployed to https://quarkus-pr-main-43245-preview.surge.sh/version/main/guides/
|
Status for workflow
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix seems to be reasonable.
I wonder if we should mention this in the CDI ref guide 🤔.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is the best we can do to make the behavior consistent.
This commit fixes that issue by turning the ArC-generated classes for framework beans into application classes whenever an application decorator applies. This makes package access impossible, which is an unfortunate downside.
I wonder if we should mention this in the CDI ref guide
We could have a configuration knob for the previous behavior which would enable the pack private access and also serve as a documentation. Although I am not sure it's worth it.
To be honest, I'd rather do a bytecode transformation that turns package-private injection points (and other things, probably?) into Documenting the package access restriction in the CDI reference guide just seems like accepting defeat. |
I don't think we want to do this everywhere and detecting just these cases might be challenging.
Yea, plus the CDI ref. guide is too broad for this peculiar case. |
Configuration knob is probably an overkill.
Hmm, keep this idea for later..
It's a small defeat. And it's ok to admit such things. It's a downside of the dev/test mode after all 🤷. |
A single line in the https://quarkus.io/guides/cdi-reference#supported_features_and_limitations after "Decoration of built-in beans, such as Event, is not supported" would be enough. |
I'm afraid it's not gonna be just a "single line", or it's gonna be a long single line. How about this?
Sounds fairly crazy to me, but if you agree, I'll add that. |
Please make it clear what you should use and actually work in the sentence. It’s not always clear to our users. |
@gsmet Well, the problem is that users can't do much in this particular case because those problematic injection points are defined in external libraries/extension runtime artifacts... |
Yes, in this particular case the user might not even know their decorator applies to a bean provided by some other fwk. |
@Ladicek You're right, sounds crazy and most readers won't be able to decrypt this message. So we should probably keep it as a secret for now 🤷. |
Any objection to merging this? |
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245 (cherry picked from commit 0d5dbd9)
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245 (cherry picked from commit 0d5dbd9)
This adding the coverage for https://issues.redhat.com/browse/QUARKUS-5178 It's tested with Quarkiverse extension as the reproducer attached in issue and it was only scenario which I was able to reproduce. To test this you need external lib which contains class (lib_class) implementing the interface. This interface is also aplied on class anotated as decorator in Quarkus app when the bean of lib_class is injected at the same time. This error happen randomly in dev/test mode. The Quarkus PR is quarkusio/quarkus#43245 (cherry picked from commit 0d5dbd9)
ArC-generated classes for framework beans are by default not application classes. This causes problems in hierarchical classloader environments (dev/test mode) when there is an application decorator that applies to the framework bean.
This commit fixes that issue by turning the ArC-generated classes for framework beans into application classes whenever an application decorator applies. This makes package access impossible, which is an unfortunate downside.
The problem doesn't exist in a flat classloading environment, such as prod mode.