While cleaning up non-Serializable fields I stumbled across OWBInjector. I hit this class pretty often and always get a cold shower. But finally we have to clean it up somehow.
It seems that the whole class was introduced to allow injection of CDI beans into EJBs. I'm not even sure if we still need this or if it's done completely different already. Fact is that it's poorly designed as it's not stateless but stores information about the 'wrapped' ee instance: /**Creational context to hold dependent instances*/ private CreationalContextImpl<?> ownerCreationalContext = null; /**Underlying javaee instance*/ private Object javaEEInstance; calling the method public OWBInjector inject(Object javaEeComponentInstance, CreationalContext<?> creationalContext) twice would overwrite the state information from the first call. That's certainly not perfect. This seems to get used in EjbInterceptorContext which in turn seems to be used when applying a @Interceptors annotation to a CDI bean. LieGrue, strub
