Buggy code:
public class SessionBeanComponentDescriptionFactory extends EJBComponentDescriptionFactory { private static final DotName STATELESS_ANNOTATION = DotName . createSimple ( Stateless . class . getName ( ) ) ; private static final DotName STATEFUL_ANNOTATION = DotName . createSimple ( Stateful . class . getName ( ) ) ; private static final DotName SINGLETON_ANNOTATION = DotName . createSimple ( Singleton . class . getName ( ) ) ; public SessionBeanComponentDescriptionFactory ( final boolean appclient ) { } @ Override protected void processAnnotations ( final DeploymentUnit deploymentUnit , final CompositeIndex compositeIndex ) throws DeploymentUnitProcessingException { } @ Override protected void processBeanMetaData ( final DeploymentUnit deploymentUnit , final EnterpriseBeanMetaData enterpriseBeanMetaData ) throws DeploymentUnitProcessingException { } private void processSessionBeans ( final DeploymentUnit deploymentUnit , final List < AnnotationInstance > sessionBeanAnnotations , final SessionBeanComponentDescription . SessionBeanType annotatedSessionBeanType ) { final EjbJarDescription ejbJarDescription = AbstractDeploymentUnitProcessor . getEjbJarDescription ( deploymentUnit ) ; final ServiceName deploymentUnitServiceName = deploymentUnit . getServiceName ( ) ; <START_BUG> final boolean replacement = deploymentUnit . getAttachment ( ANNOTATION_PROPERTY_REPLACEMENT ) ; <END_BUG> for ( final AnnotationInstance sessionBeanAnnotation : sessionBeanAnnotations ) { final AnnotationTarget target = sessionBeanAnnotation . target ( ) ; if ( ! ( target instanceof ClassInfo ) ) { MESSAGES . annotationOnlyAllowedOnClass ( sessionBeanAnnotation . name ( ) . toString ( ) , target ) ; continue ; } final ClassInfo sessionBeanClassInfo = ( ( ClassInfo ) ( target ) ) ; if ( ! ( SessionBeanComponentDescriptionFactory . assertSessionBeanClassValidity ( sessionBeanClassInfo ) ) ) { continue ; } final String ejbName = sessionBeanClassInfo . name ( ) . local ( ) ; final AnnotationValue nameValue = sessionBeanAnnotation . value ( "name" ) ; final String beanName = ( ( nameValue == null ) || ( nameValue . asString ( ) . isEmpty ( ) ) ) ? ejbName : replacement ? PropertiesValueResolver . replaceProperties ( nameValue . asString ( ) ) : nameValue . asString ( ) ; final SessionBeanMetaData beanMetaData = getEnterpriseBeanMetaData ( deploymentUnit , beanName , SessionBeanMetaData . class ) ; final SessionBeanComponentDescription . SessionBeanType sessionBeanType ; final String beanClassName ; if ( beanMetaData != null ) { beanClassName = override ( sessionBeanClassInfo . name ( ) . toString ( ) , beanMetaData . getEjbClass ( ) ) ; sessionBeanType = override ( annotatedSessionBeanType , SessionBeanComponentDescriptionFactory . descriptionOf ( ( ( SessionBeanMetaData ) ( beanMetaData ) ) . getSessionType ( ) ) ) ; } else { beanClassName = sessionBeanClassInfo . name ( ) . toString ( ) ; sessionBeanType = annotatedSessionBeanType ; } final SessionBeanComponentDescription sessionBeanDescription ; switch ( sessionBeanType ) { case STATELESS : sessionBeanDescription = new org . jboss . as . ejb3 . component . stateless . StatelessComponentDescription ( beanName , beanClassName , ejbJarDescription , deploymentUnitServiceName , beanMetaData ) ; break ; case STATEFUL : sessionBeanDescription = new org . jboss . as . ejb3 . component . stateful . StatefulComponentDescription ( beanName , beanClassName , ejbJarDescription , deploymentUnitServiceName , beanMetaData ) ; final boolean passivationCapableAnnotationValue = ( ( sessionBeanAnnotation . value ( "passivationCapable" ) ) == null ) ? true : sessionBeanAnnotation . value ( "passivationCapable" ) . asBoolean ( ) ; final Boolean passivationCapableDeploymentDescriptorValue ; if ( beanMetaData instanceof SessionBean32MetaData ) { passivationCapableDeploymentDescriptorValue = ( ( SessionBean32MetaData ) ( beanMetaData ) ) . isPassivationCapable ( ) ; } else { passivationCapableDeploymentDescriptorValue = null ; } final boolean passivationApplicable = override ( passivationCapableDeploymentDescriptorValue , passivationCapableAnnotationValue ) ; ( ( org . jboss . as . ejb3 . component . stateful . StatefulComponentDescription ) ( sessionBeanDescription ) ) . setPassivationApplicable ( passivationApplicable ) ; break ; case SINGLETON : sessionBeanDescription = new org . jboss . as . ejb3 . component . singleton . SingletonComponentDescription ( beanName , beanClassName , ejbJarDescription , deploymentUnitServiceName , beanMetaData ) ; break ; default : throw MESSAGES . unknownSessionBeanType ( sessionBeanType . name ( ) ) ; } addComponent ( deploymentUnit , sessionBeanDescription ) ; } EjbDeploymentMarker . mark ( deploymentUnit ) ; } private static SessionBeanType descriptionOf ( final SessionType sessionType ) { } private static boolean assertSessionBeanClassValidity ( final ClassInfo sessionBeanClass ) { } private void processSessionBeanMetaData ( final DeploymentUnit deploymentUnit , final SessionBeanMetaData sessionBean ) throws DeploymentUnitProcessingException { } private SessionType determineSessionType ( final String ejbClass , final CompositeIndex compositeIndex ) { } }

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