Buggy code:
public class ManagedBeanAnnotationProcessor implements DeploymentUnitProcessor { static final DotName MANAGED_BEAN_ANNOTATION_NAME = DotName . createSimple ( ManagedBean . class . getName ( ) ) ; public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final EEResourceReferenceProcessorRegistry registry = deploymentUnit . getAttachment ( RESOURCE_REFERENCE_PROCESSOR_REGISTRY ) ; final EEModuleDescription moduleDescription = deploymentUnit . getAttachment ( EE_MODULE_DESCRIPTION ) ; final CompositeIndex compositeIndex = deploymentUnit . getAttachment ( COMPOSITE_ANNOTATION_INDEX ) ; <START_BUG> final boolean replacement = deploymentUnit . getAttachment ( ANNOTATION_PROPERTY_REPLACEMENT ) ; <END_BUG> final PropertyReplacer replacer = EJBAnnotationPropertyReplacement . propertyReplacer ( deploymentUnit ) ; if ( compositeIndex == null ) { return ; } final List < AnnotationInstance > instances = compositeIndex . getAnnotations ( ManagedBeanAnnotationProcessor . MANAGED_BEAN_ANNOTATION_NAME ) ; if ( ( instances == null ) || ( instances . isEmpty ( ) ) ) { return ; } for ( AnnotationInstance instance : instances ) { AnnotationTarget target = instance . target ( ) ; if ( ! ( target instanceof ClassInfo ) ) { throw EeMessages . MESSAGES . classOnlyAnnotation ( "@ManagedBean" , target ) ; } final ClassInfo classInfo = ( ( ClassInfo ) ( target ) ) ; if ( ! ( ManagedBeanAnnotationProcessor . assertManagedBeanClassValidity ( classInfo ) ) ) { continue ; } final String beanClassName = classInfo . name ( ) . toString ( ) ; final AnnotationValue nameValue = instance . value ( ) ; final String beanName = ( ( nameValue == null ) || ( nameValue . asString ( ) . isEmpty ( ) ) ) ? beanClassName : replacement ? replacer . replaceProperties ( nameValue . asString ( ) ) : nameValue . asString ( ) ; final ManagedBeanComponentDescription componentDescription = new ManagedBeanComponentDescription ( beanName , beanClassName , moduleDescription , deploymentUnit . getServiceName ( ) ) ; ViewDescription viewDescription = new ViewDescription ( componentDescription , beanClassName ) ; viewDescription . getConfigurators ( ) . addFirst ( new ViewConfigurator ( ) { public void configure ( final DeploymentPhaseContext context , final ComponentConfiguration componentConfiguration , final ViewDescription description , final ViewConfiguration configuration ) throws DeploymentUnitProcessingException { configuration . addClientPostConstructInterceptor ( FACTORY , INSTANCE_CREATE ) ; final ClassLoader classLoader = componentConfiguration . getModuleClassLoader ( ) ; configuration . addViewInterceptor ( PrivilegedWithCombinerInterceptor . getFactory ( ) , PRIVILEGED_INTERCEPTOR ) ; configuration . addViewInterceptor ( AccessCheckingInterceptor . getFactory ( ) , CHECKING_INTERCEPTOR ) ; configuration . addViewInterceptor ( new org . jboss . invocation . ImmediateInterceptorFactory ( new ContextClassLoaderInterceptor ( classLoader ) ) , TCCL_INTERCEPTOR ) ; } } ) ; viewDescription . getBindingNames ( ) . addAll ( Arrays . asList ( ( "java:module//" + beanName ) , ( ( ( "java:app//" + ( moduleDescription . getModuleName ( ) ) ) + "//" ) + beanName ) ) ) ; componentDescription . getViews ( ) . add ( viewDescription ) ; moduleDescription . addComponent ( componentDescription ) ; registry . registerResourceReferenceProcessor ( new ManagedBeanResourceReferenceProcessor ( beanClassName ) ) ; } } public void undeploy ( DeploymentUnit context ) { } private static boolean assertManagedBeanClassValidity ( final ClassInfo managedBeanClass ) { } }

Fix:
final boolean replacement = deploymentUnit . getAttachment ( EJB_ANNOTATION_PROPERTY_REPLACEMENT ) ;