Buggy code:
public class MessageDrivenComponentDescriptionFactory extends EJBComponentDescriptionFactory { private static final DotName MESSAGE_DRIVEN_ANNOTATION_NAME = DotName . createSimple ( MessageDriven . class . getName ( ) ) ; public MessageDrivenComponentDescriptionFactory ( final boolean appclient ) { } @ Override protected void processAnnotations ( DeploymentUnit deploymentUnit , CompositeIndex compositeIndex ) throws DeploymentUnitProcessingException { } @ Override protected void processBeanMetaData ( final DeploymentUnit deploymentUnit , final EnterpriseBeanMetaData enterpriseBeanMetaData ) throws DeploymentUnitProcessingException { } private void processMessageBeans ( final DeploymentUnit deploymentUnit , final Collection < AnnotationInstance > messageBeanAnnotations , final CompositeIndex compositeIndex ) throws DeploymentUnitProcessingException { if ( messageBeanAnnotations . isEmpty ( ) ) return ; final EjbJarDescription ejbJarDescription = AbstractDeploymentUnitProcessor . getEjbJarDescription ( deploymentUnit ) ; final ServiceName deploymentUnitServiceName = deploymentUnit . getServiceName ( ) ; DeploymentDescriptorEnvironment deploymentDescriptorEnvironment = null ; for ( final AnnotationInstance messageBeanAnnotation : messageBeanAnnotations ) { final AnnotationTarget target = messageBeanAnnotation . target ( ) ; final ClassInfo beanClassInfo = ( ( ClassInfo ) ( target ) ) ; if ( ! ( assertMDBClassValidity ( beanClassInfo ) ) ) { continue ; } <START_BUG> final boolean replacement = deploymentUnit . getAttachment ( EJB_ANNOTATION_PROPERTY_REPLACEMENT ) ; <END_BUG> final String ejbName = beanClassInfo . name ( ) . local ( ) ; final AnnotationValue nameValue = messageBeanAnnotation . value ( "name" ) ; final String beanName = ( ( nameValue == null ) || ( nameValue . asString ( ) . isEmpty ( ) ) ) ? ejbName : replacement ? PropertiesValueResolver . replaceProperties ( nameValue . asString ( ) ) : nameValue . asString ( ) ; final MessageDrivenBeanMetaData beanMetaData = getEnterpriseBeanMetaData ( deploymentUnit , beanName , MessageDrivenBeanMetaData . class ) ; final String beanClassName ; final String messageListenerInterfaceName ; final Properties activationConfigProperties = getActivationConfigProperties ( messageBeanAnnotation , replacement ) ; final String messagingType ; if ( beanMetaData != null ) { beanClassName = override ( beanClassInfo . name ( ) . toString ( ) , beanMetaData . getEjbClass ( ) ) ; deploymentDescriptorEnvironment = new DeploymentDescriptorEnvironment ( "java:comp//env//" , beanMetaData ) ; if ( beanMetaData instanceof MessageDrivenBeanMetaData ) { final MessageDrivenBeanMetaData mdb = ( ( MessageDrivenBeanMetaData ) ( beanMetaData ) ) ; messagingType = mdb . getMessagingType ( ) ; final ActivationConfigMetaData activationConfigMetaData = mdb . getActivationConfig ( ) ; if ( activationConfigMetaData != null ) { final ActivationConfigPropertiesMetaData propertiesMetaData = activationConfigMetaData . getActivationConfigProperties ( ) ; if ( propertiesMetaData != null ) { for ( final ActivationConfigPropertyMetaData propertyMetaData : propertiesMetaData ) { activationConfigProperties . put ( propertyMetaData . getKey ( ) , propertyMetaData . getValue ( ) ) ; } } } } else if ( beanMetaData instanceof JBossGenericBeanMetaData ) { final JBossGenericBeanMetaData mdb = ( ( JBossGenericBeanMetaData ) ( beanMetaData ) ) ; messagingType = mdb . getMessagingType ( ) ; final ActivationConfigMetaData activationConfigMetaData = mdb . getActivationConfig ( ) ; if ( activationConfigMetaData != null ) { final ActivationConfigPropertiesMetaData propertiesMetaData = activationConfigMetaData . getActivationConfigProperties ( ) ; if ( propertiesMetaData != null ) { for ( final ActivationConfigPropertyMetaData propertyMetaData : propertiesMetaData ) { activationConfigProperties . put ( propertyMetaData . getKey ( ) , propertyMetaData . getValue ( ) ) ; } } } } else { messagingType = null ; } messageListenerInterfaceName = ( messagingType != null ) ? messagingType : getMessageListenerInterface ( compositeIndex , messageBeanAnnotation ) ; } else { beanClassName = beanClassInfo . name ( ) . toString ( ) ; messageListenerInterfaceName = getMessageListenerInterface ( compositeIndex , messageBeanAnnotation ) ; } final String defaultResourceAdapterName = this . getDefaultResourceAdapterName ( deploymentUnit . getServiceRegistry ( ) ) ; final MessageDrivenComponentDescription beanDescription = new MessageDrivenComponentDescription ( beanName , beanClassName , ejbJarDescription , deploymentUnitServiceName , messageListenerInterfaceName , activationConfigProperties , defaultResourceAdapterName , beanMetaData ) ; beanDescription . setDeploymentDescriptorEnvironment ( deploymentDescriptorEnvironment ) ; addComponent ( deploymentUnit , beanDescription ) ; } EjbDeploymentMarker . mark ( deploymentUnit ) ; } private String getMessageListenerInterface ( final CompositeIndex compositeIndex , final AnnotationInstance messageBeanAnnotation ) throws DeploymentUnitProcessingException { } private boolean assertMDBClassValidity ( final ClassInfo mdbClass ) { } private Properties getActivationConfigProperties ( final ActivationConfigMetaData activationConfig ) { } private void processMessageDrivenBeanMetaData ( final DeploymentUnit deploymentUnit , final MessageDrivenBeanMetaData mdb ) throws DeploymentUnitProcessingException { } private Properties getActivationConfigProperties ( final AnnotationInstance messageBeanAnnotation , boolean replacement ) { } private String getDefaultResourceAdapterName ( final ServiceRegistry serviceRegistry ) { } }

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