Buggy code:
public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader implements GroovyObject { private final XmlBeanDefinitionReader xmlBeanDefinitionReader ; private MetaClass metaClass = GroovySystem . getMetaClassRegistry ( ) . getMetaClass ( getClass ( ) ) ; private Binding binding ; private GroovyBeanDefinitionWrapper currentBeanDefinition ; private final Map < String , String > namespaces = new HashMap < String , String > ( ) ; private final Map < String , GroovyBeanDefinitionReader . DeferredProperty > deferredProperties = new HashMap < String , GroovyBeanDefinitionReader . DeferredProperty > ( ) ; public GroovyBeanDefinitionReader ( BeanDefinitionRegistry registry ) { } public GroovyBeanDefinitionReader ( XmlBeanDefinitionReader xmlBeanDefinitionReader ) { } public void setMetaClass ( MetaClass metaClass ) { } public MetaClass getMetaClass ( ) { } public void setBinding ( Binding binding ) { } public Binding getBinding ( ) { } public int loadBeanDefinitions ( Resource resource ) throws BeanDefinitionStoreException { } public int loadBeanDefinitions ( EncodedResource encodedResource ) throws BeanDefinitionStoreException { } public GroovyBeanDefinitionReader beans ( Closure closure ) { } public GenericBeanDefinition bean ( Class < ? > type ) { } public AbstractBeanDefinition bean ( Class < ? > type , Object ... args ) { } public void xmlns ( Map < String , String > definition ) { } public void importBeans ( String resourcePattern ) throws IOException { } public Object invokeMethod ( String name , Object arg ) { } private boolean addDeferredProperty ( String property , Object newValue ) { } private void finalizeDeferredProperties ( ) { } protected GroovyBeanDefinitionReader invokeBeanDefiningClosure ( Closure callable ) { } private GroovyBeanDefinitionWrapper invokeBeanDefiningMethod ( String beanName , Object [ ] args ) { } protected List < Object > resolveConstructorArguments ( Object [ ] args , int start , int end ) { } private Object manageMapIfNecessary ( Map < ? , ? > map ) { } private Object manageListIfNecessary ( List < ? > list ) { } public void setProperty ( String name , Object value ) { } protected void applyPropertyToBeanDefinition ( String name , Object value ) { } public Object getProperty ( String name ) { } private GroovyDynamicElementReader createDynamicElementReader ( String namespace ) { XmlReaderContext readerContext = this . xmlBeanDefinitionReader . createReaderContext ( new DescriptiveResource ( "Groovy" ) ) ; <START_BUG> BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate ( readerContext , getEnvironment ( ) ) ; <END_BUG> boolean decorating = ( this . currentBeanDefinition ) != null ; if ( ! decorating ) { this . currentBeanDefinition = new GroovyBeanDefinitionWrapper ( namespace ) ; } return new GroovyDynamicElementReader ( namespace , this . namespaces , delegate , this . currentBeanDefinition , decorating ) { @ Override protected void afterInvocation ( ) { if ( ! ( this . decorating ) ) { currentBeanDefinition = null ; } } } ; } private static class DeferredProperty { private final GroovyBeanDefinitionWrapper beanDefinition ; private final String name ; public Object value ; public DeferredProperty ( GroovyBeanDefinitionWrapper beanDefinition , String name , Object value ) { } public void apply ( ) { } } private class GroovyRuntimeBeanReference extends RuntimeBeanReference implements GroovyObject { private final GroovyBeanDefinitionWrapper beanDefinition ; private MetaClass metaClass ; public GroovyRuntimeBeanReference ( String beanName , GroovyBeanDefinitionWrapper beanDefinition , boolean toParent ) { } public MetaClass getMetaClass ( ) { } public Object getProperty ( String property ) { } public Object invokeMethod ( String name , Object args ) { } public void setMetaClass ( MetaClass metaClass ) { } public void setProperty ( String property , Object newValue ) { } private class GroovyPropertyValue extends GroovyObjectSupport { private final String propertyName ; private final Object propertyValue ; public GroovyPropertyValue ( String propertyName , Object propertyValue ) { } public void leftShift ( Object value ) { } public boolean add ( Object value ) { } public boolean addAll ( Collection values ) { } public Object invokeMethod ( String name , Object args ) { } public Object getProperty ( String name ) { } public void setProperty ( String name , Object value ) { } private void updateDeferredProperties ( Object value ) { } } } }

Fix:
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate ( readerContext ) ;