Buggy code:
public final class TransformerRegistry { public static final ModelNode DISCARD_OPERATION = new ModelNode ( ) ; private final ExtensionRegistry extensionRegistry ; private static final PathElement HOST = PathElement . pathElement ( ModelDescriptionConstants . HOST ) ; private static final PathElement PROFILE = PathElement . pathElement ( ModelDescriptionConstants . PROFILE ) ; private static final PathElement SERVER = PathElement . pathElement ( RUNNING_SERVER ) ; private final GlobalTransformerRegistry domain = new GlobalTransformerRegistry ( ) ; private final GlobalTransformerRegistry subsystem = new GlobalTransformerRegistry ( ) ; TransformerRegistry ( final ExtensionRegistry extensionRegistry ) { } public ExtensionRegistry getExtensionRegistry ( ) { } public TransformersSubRegistration registerSubsystemTransformers ( final String name , final ModelVersionRange range , final ResourceTransformer subsystemTransformer ) { } public TransformersSubRegistration getDomainRegistration ( final ModelVersionRange range ) { } public TransformersSubRegistration getHostRegistration ( final ModelVersionRange range ) { } public TransformersSubRegistration getServerRegistration ( final ModelVersionRange range ) { } public OperationTransformerRegistry resolveHost ( final ModelVersion mgmtVersion , final ModelNode subsystems ) { } public OperationTransformerRegistry resolveHost ( final ModelVersion mgmtVersion , final Map < PathAddress , ModelVersion > subsystems ) { } public OperationTransformerRegistry resolveServer ( final ModelVersion mgmtVersion , final ModelNode subsystems ) { } public OperationTransformerRegistry resolveServer ( final ModelVersion mgmtVersion , final Map < PathAddress , ModelVersion > subsystems ) { } void addSubsystem ( final OperationTransformerRegistry registry , final String name , final ModelVersion version ) { } public static Map < PathAddress , ModelVersion > resolveVersions ( ExtensionRegistry extensionRegistry ) { } public static Map < PathAddress , ModelVersion > resolveVersions ( final ModelNode subsystems ) { } static ModelVersion convert ( final String version ) { } public static ResourceDefinition loadSubsystemDefinition ( final String subsystemName , final ModelVersion version ) { } public static Resource modelToResource ( final ImmutableManagementResourceRegistration reg , final ModelNode model , boolean includeUndefined ) { <START_BUG> return TransformationUtils . modelToResource ( reg , model , includeUndefined ) ; <END_BUG> } public static class Factory { public static TransformerRegistry create ( ExtensionRegistry extensionRegistry ) { } } public static class TransformersSubRegistrationImpl implements TransformersSubRegistration { private final PathAddress current ; private final ModelVersionRange range ; private final GlobalTransformerRegistry registry ; public TransformersSubRegistrationImpl ( ModelVersionRange range , GlobalTransformerRegistry registry , PathAddress parent ) { } @ Override public TransformersSubRegistration registerSubResource ( PathElement element ) { } @ Override public TransformersSubRegistration registerSubResource ( PathElement element , boolean discard ) { } @ Override public TransformersSubRegistration registerSubResource ( PathElement element , OperationTransformer operationTransformer ) { } @ Override public TransformersSubRegistration registerSubResource ( PathElement element , ResourceTransformer resourceTransformer ) { } @ Override public TransformersSubRegistration registerSubResource ( PathElement element , ResourceTransformer resourceTransformer , OperationTransformer operationTransformer ) { } @ Override public void discardOperations ( String ... operationNames ) { } @ Override public void registerOperationTransformer ( String operationName , OperationTransformer transformer ) { } } }

Fix:
return TransformationUtils . modelToResource ( EMPTY_ADDRESS , reg , model , includeUndefined ) ;