private static void reallyValidatePseudoScopedBean ( Bean < ? > bean , BeanManagerImpl beanManager , Set < Object > dependencyPath , Set < Bean < ? > > validatedBeans ) { // see if we have already seen this bean in the dependency path if ( dependencyPath . contains ( bean ) ) { // create a list that shows the path to the bean List < Object > realDependencyPath = new ArrayList < Object > ( dependencyPath ) ; realDependencyPath . add ( bean ) ; throw ValidatorLogger . LOG . pseudoScopedBeanHasCircularReferences ( WeldCollections . toMultiRowString ( realDependencyPath ) ) ; } if ( validatedBeans . contains ( bean ) ) { return ; } dependencyPath . add ( bean ) ; for ( InjectionPoint injectionPoint : bean . getInjectionPoints ( ) ) { if ( ! injectionPoint . isDelegate ( ) ) { dependencyPath . add ( injectionPoint ) ; validatePseudoScopedInjectionPoint ( injectionPoint , beanManager , dependencyPath , validatedBeans ) ; dependencyPath . remove ( injectionPoint ) ; } } if ( bean instanceof DecorableBean < ? > ) { final List < Decorator < ? > > decorators = Reflections . < DecorableBean < ? > > cast ( bean ) . getDecorators ( ) ; if ( ! decorators . isEmpty ( ) ) { for ( final Decorator < ? > decorator : decorators ) { reallyValidatePseudoScopedBean ( decorator , beanManager , dependencyPath , validatedBeans ) ; } } } if ( bean instanceof AbstractProducerBean < ? , ? , ? > && ! ( bean instanceof EEResourceProducerField < ? , ? > ) ) { AbstractProducerBean < ? , ? , ? > producer = ( AbstractProducerBean < ? , ? , ? > ) bean ; if ( ! beanManager . isNormalScope ( producer . getDeclaringBean ( ) . getScope ( ) ) && ! producer . getAnnotated ( ) . isStatic ( ) ) { reallyValidatePseudoScopedBean ( producer . getDeclaringBean ( ) , beanManager , dependencyPath , validatedBeans ) ; } } validatedBeans . add ( bean ) ; dependencyPath . remove ( bean ) ; }
checks if a bean has been seen before in the dependencyPath . If not it resolves the InjectionPoints and adds the resolved beans to the set of beans to be validated