Buggy code:
public static final OptionAttributeDefinition MAX_ENTITY_SIZE = OptionAttributeDefinition . builder ( MAX_POST_SIZE , UndertowOptions . MAX_ENTITY_SIZE ) . setDefaultValue ( new ModelNode ( 10485760L ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition BUFFER_PIPELINED_DATA = OptionAttributeDefinition . builder ( "buffer-pipelined-data" , UndertowOptions . BUFFER_PIPELINED_DATA ) . setDefaultValue ( new ModelNode ( true ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition MAX_PARAMETERS = OptionAttributeDefinition . builder ( "max-parameters" , UndertowOptions . MAX_PARAMETERS ) . setDefaultValue ( new ModelNode ( 1000 ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition MAX_HEADERS = OptionAttributeDefinition . builder ( "max-headers" , UndertowOptions . MAX_HEADERS ) . setDefaultValue ( new ModelNode ( 200 ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition MAX_COOKIES = OptionAttributeDefinition . builder ( "max-cookies" , UndertowOptions . MAX_COOKIES ) . setDefaultValue ( new ModelNode ( 200 ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition ALLOW_ENCODED_SLASH = OptionAttributeDefinition . builder ( "allow-encoded-slash" , UndertowOptions . ALLOW_ENCODED_SLASH ) . setDefaultValue ( new ModelNode ( false ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition DECODE_URL = OptionAttributeDefinition . builder ( "decode-url" , UndertowOptions . DECODE_URL ) . setDefaultValue ( new ModelNode ( true ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition URL_CHARSET = OptionAttributeDefinition . builder ( "url-charset" , UndertowOptions . URL_CHARSET ) . setDefaultValue ( new ModelNode ( "UTF-8" ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition ALWAYS_SET_KEEP_ALIVE = OptionAttributeDefinition . builder ( "always-set-keep-alive" , UndertowOptions . ALWAYS_SET_KEEP_ALIVE ) . setDefaultValue ( new ModelNode ( true ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition MAX_BUFFERED_REQUEST_SIZE = OptionAttributeDefinition . builder ( "max-buffered-request-size" , UndertowOptions . MAX_BUFFERED_REQUEST_SIZE ) . setDefaultValue ( new ModelNode ( 16384 ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition RECORD_REQUEST_START_TIME = OptionAttributeDefinition . builder ( "record-request-start-time" , UndertowOptions . RECORD_REQUEST_START_TIME ) . setDefaultValue ( new ModelNode ( false ) ) . setAllowExpression ( true ) . build ( ) ; public static final OptionAttributeDefinition ALLOW_EQUALS_IN_COOKIE_VALUE = OptionAttributeDefinition . builder ( "allow-equals-in-cookie-value" , UndertowOptions . ALLOW_EQUALS_IN_COOKIE_VALUE ) . setDefaultValue ( new ModelNode ( false ) ) . setAllowExpression ( true ) . build ( ) ; public enum ConnectorStat { REQUEST_COUNT ( new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "request-count" , org . jboss . dmr . ModelType . LONG , false ) . setStorageRuntime ( ) . build ( ) ) , BYTES_SENT ( new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "bytes-sent" , org . jboss . dmr . ModelType . LONG , false ) . setStorageRuntime ( ) . build ( ) ) , BYTES_RECEIVED ( new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "bytes-received" , org . jboss . dmr . ModelType . LONG , false ) . setStorageRuntime ( ) . build ( ) ) , ERROR_COUNT ( new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "error-count" , org . jboss . dmr . ModelType . LONG , false ) . setStorageRuntime ( ) . build ( ) ) , PROCESSING_TIME ( new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "processing-time" , org . jboss . dmr . ModelType . LONG , false ) . setStorageRuntime ( ) . build ( ) ) , MAX_PROCESSING_TIME ( new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "max-processing-time" , org . jboss . dmr . ModelType . LONG , false ) . setStorageRuntime ( ) . build ( ) ) ; private static final Map < String , ListenerResourceDefinition . ConnectorStat > MAP = new HashMap < > ( ) ; final AttributeDefinition definition ; private ConnectorStat ( final AttributeDefinition definition ) { } @ Override public final String toString ( ) { } public static synchronized ListenerResourceDefinition . ConnectorStat getStat ( final String stringForm ) { } } protected static final Collection ATTRIBUTES ; protected static final List < AccessConstraintDefinition > CONSTRAINTS = Arrays . asList ( LISTENER_CONSTRAINT ) ; public static final List < OptionAttributeDefinition > LISTENER_OPTIONS = Arrays . asList ( ListenerResourceDefinition . MAX_HEADER_SIZE , ListenerResourceDefinition . MAX_ENTITY_SIZE , ListenerResourceDefinition . BUFFER_PIPELINED_DATA , ListenerResourceDefinition . MAX_PARAMETERS , ListenerResourceDefinition . MAX_HEADERS , ListenerResourceDefinition . MAX_COOKIES , ListenerResourceDefinition . ALLOW_ENCODED_SLASH , ListenerResourceDefinition . DECODE_URL , ListenerResourceDefinition . URL_CHARSET , ListenerResourceDefinition . ALWAYS_SET_KEEP_ALIVE , ListenerResourceDefinition . MAX_BUFFERED_REQUEST_SIZE , ListenerResourceDefinition . RECORD_REQUEST_START_TIME , ListenerResourceDefinition . ALLOW_EQUALS_IN_COOKIE_VALUE ) ; public static final List < OptionAttributeDefinition > SOCKET_OPTIONS = Arrays . asList ( ListenerResourceDefinition . BACKLOG , ListenerResourceDefinition . RECEIVE_BUFFER , ListenerResourceDefinition . SEND_BUFFER , ListenerResourceDefinition . KEEP_ALIVE , ListenerResourceDefinition . READ_TIMEOUT , ListenerResourceDefinition . WRITE_TIMEOUT ) ; public ListenerResourceDefinition ( PathElement pathElement ) { } public Collection < AttributeDefinition > getAttributes ( ) { } @ Override public void registerOperations ( ManagementResourceRegistration resourceRegistration ) { } @ Override public void registerAttributes ( ManagementResourceRegistration resourceRegistration ) { super . registerAttributes ( resourceRegistration ) ; for ( ListenerResourceDefinition . ConnectorStat attr : ListenerResourceDefinition . ConnectorStat . values ( ) ) { <START_BUG> resourceRegistration . registerMetric ( attr . definition , ListenerResourceDefinition . ReadStatisticHandler . INSTANCE ) ; <END_BUG> } } @ Override public List < AccessConstraintDefinition > getAccessConstraints ( ) { } protected abstract ListenerAdd getAddHandler ( ) { } private static class ReadStatisticHandler implements OperationStepHandler { public static final ListenerResourceDefinition . ReadStatisticHandler INSTANCE = new ListenerResourceDefinition . ReadStatisticHandler ( ) ; private ReadStatisticHandler ( ) { } public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { } } }

Fix:
resourceRegistration . registerReadOnlyAttribute ( attr . definition , ListenerResourceDefinition . ReadStatisticHandler . INSTANCE ) ;