eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
165 stars 112 forks source link

Fix 5457: revert removal of getBeanClass on Faces artifact producers #5458

Closed BalusC closed 4 months ago

BalusC commented 4 months ago

Fix #5457: revert removal of getBeanClass on Faces artifact producers; adjust it to check if Weld is used and if so return CdiExtension.class

arjantijms commented 4 months ago

@manovotn just thinking out loud, but can't we do something at the spec level to replace this:

  protected CdiProducer<T> beanClass(BeanManager beanManager, Class<?> beanClass) {
         if (CdiUtils.isWeld(beanManager)) {
             this.beanClass = CdiExtension.class; // See #5457 and #5157
         } else {
             this.beanClass = beanClass;
         }

         return this;
     }

Maybe something like

public interface Bean<T> ...

    public Class<?>[] getBeanClasses();
}

With [0] the bean class as you would intuitively think about (the class of the bean, literally the name) And [1] the class of the extension in which Bean is created.

I haven't given it much more though, but in that way we would be able to keep both Weld and other CDI implementations happy?