eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
160 stars 109 forks source link

`CdiExtension` incorrectly uses `beanClass` as means to determine implementation class of a bean #5159

Closed manovotn closed 1 week ago

manovotn commented 1 year ago

Describe the bug

In the current state of CdiExtension, it uses Bean#getBeanClass() to derive the impl class of a bean. See this code. This is wrong because there can be three types of beans and this only works as expected with one of them:

I am far from being expert in Mojarra, so maybe this is fine and the bean will always be a managed bean; I'll let someone else decide that. I just wanted to point this out since I noticed it. It could be that this is perfectly fine.

I am also not sure what would be a good replacement because being able to derive the exact impl class (if that's the requirement here?) from a bean is beyond CDI extension capabilities simply because you can either (a) limit bean types and (b) with producers you can choose to instantiate one of multiple subclasses during runtime and CDI cannot know which.

BalusC commented 1 year ago

@arjantijms can you take a look at it?

struberg commented 2 months ago

-1

See my comment in https://github.com/eclipse-ee4j/mojarra/issues/5157#issuecomment-2213544002

There is nothing in the spec backing this claim, and it breaks OpenWebBeans and TomEE.

BalusC commented 1 week ago

Fixed via https://github.com/eclipse-ee4j/mojarra/issues/5457