quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.36k stars 2.56k forks source link

Simplify unproxyability errors #33668

Closed Ladicek closed 8 months ago

Ladicek commented 1 year ago

Description

The CDI specification demands that if a bean isn't injected anywhere, unproxyability shouldn't be a deployment problem, but an exception at runtime. This is a confusing special case, as detailed in https://github.com/jakartaee/cdi/issues/673. We implemented this behavior in #33523 for specification compatibility, but only in the ArC strict mode, because the default ArC behavior makes more sense for build-time oriented implementations and is generally more useful and easier to understand.

Implementation ideas

If we can change the specification to allow (or even demand?) ArC's default behavior, we should be able to revert the commit that implements the behavior prescribed by CDI 4.0.

manovotn commented 8 months ago

I did some investigation on spec side to determine if we can alter the requirements and unfortunately, I don't think we can.

Details are in https://github.com/jakartaee/cdi/issues/673#issuecomment-1795037841 but in short, the current behavior is intentional and defined to allow for more flexibility in what's proxyable and when. Furthermore, specification defines proxyability in terms of bean types whereas in ArC we do that for whole beans (which allows us to pre-generate a single proxy class for each bean but we lose some of the flexibility).