Buggy code:
public class ConfigurationClassPostProcessor implements BeanClassLoaderAware , BeanDefinitionRegistryPostProcessor , EnvironmentAware , ResourceLoaderAware { private static final String IMPORT_AWARE_PROCESSOR_BEAN_NAME = ( ConfigurationClassPostProcessor . class . getName ( ) ) + ".importAwareProcessor" ; private static final String IMPORT_REGISTRY_BEAN_NAME = ( ConfigurationClassPostProcessor . class . getName ( ) ) + ".importRegistry" ; private final Log logger = LogFactory . getLog ( getClass ( ) ) ; private SourceExtractor sourceExtractor = new PassThroughSourceExtractor ( ) ; private ProblemReporter problemReporter = new FailFastProblemReporter ( ) ; private Environment environment ; private ResourceLoader resourceLoader = new DefaultResourceLoader ( ) ; private ClassLoader beanClassLoader = ClassUtils . getDefaultClassLoader ( ) ; private MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory ( ) ; private boolean setMetadataReaderFactoryCalled = false ; private final Set < Integer > registriesPostProcessed = new HashSet < Integer > ( ) ; private final Set < Integer > factoriesPostProcessed = new HashSet < Integer > ( ) ; private ConfigurationClassBeanDefinitionReader reader ; private boolean localBeanNameGeneratorSet = false ; private BeanNameGenerator componentScanBeanNameGenerator = new AnnotationBeanNameGenerator ( ) ; private BeanNameGenerator importBeanNameGenerator = new AnnotationBeanNameGenerator ( ) { @ Override protected String buildDefaultBeanName ( BeanDefinition definition ) { } } ; public void setSourceExtractor ( SourceExtractor sourceExtractor ) { } public void setProblemReporter ( ProblemReporter problemReporter ) { } public void setMetadataReaderFactory ( MetadataReaderFactory metadataReaderFactory ) { } public void setBeanNameGenerator ( BeanNameGenerator beanNameGenerator ) { } public void setEnvironment ( Environment environment ) { } public void setResourceLoader ( ResourceLoader resourceLoader ) { } public void setBeanClassLoader ( ClassLoader beanClassLoader ) { } public void postProcessBeanDefinitionRegistry ( BeanDefinitionRegistry registry ) { } public void postProcessBeanFactory ( ConfigurableListableBeanFactory beanFactory ) { } public void processConfigBeanDefinitions ( BeanDefinitionRegistry registry ) { } public void enhanceConfigurationClasses ( ConfigurableListableBeanFactory beanFactory ) { Map < String , AbstractBeanDefinition > configBeanDefs = new LinkedHashMap < String , AbstractBeanDefinition > ( ) ; for ( String beanName : beanFactory . getBeanDefinitionNames ( ) ) { BeanDefinition beanDef = beanFactory . getBeanDefinition ( beanName ) ; if ( ConfigurationClassUtils . isFullConfigurationClass ( beanDef ) ) { if ( ! ( beanDef instanceof AbstractBeanDefinition ) ) { throw new BeanDefinitionStoreException ( ( ( "Cannot<seq2seq4repair_space>enhance<seq2seq4repair_space>@Configuration<seq2seq4repair_space>bean<seq2seq4repair_space>definition<seq2seq4repair_space>'" + beanName ) + "'<seq2seq4repair_space>since<seq2seq4repair_space>it<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>stored<seq2seq4repair_space>in<seq2seq4repair_space>an<seq2seq4repair_space>AbstractBeanDefinition<seq2seq4repair_space>subclass" ) ) ; } configBeanDefs . put ( beanName , ( ( AbstractBeanDefinition ) ( beanDef ) ) ) ; } } if ( configBeanDefs . isEmpty ( ) ) { return ; } <START_BUG> ConfigurationClassEnhancer enhancer = new ConfigurationClassEnhancer ( beanFactory ) ; <END_BUG> for ( Map . Entry < String , AbstractBeanDefinition > entry : configBeanDefs . entrySet ( ) ) { AbstractBeanDefinition beanDef = entry . getValue ( ) ; try { Class < ? > configClass = beanDef . resolveBeanClass ( this . beanClassLoader ) ; Class < ? > enhancedClass = enhancer . enhance ( configClass ) ; if ( configClass != enhancedClass ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( String . format ( ( "Replacing<seq2seq4repair_space>bean<seq2seq4repair_space>definition<seq2seq4repair_space>'%s'<seq2seq4repair_space>existing<seq2seq4repair_space>class<seq2seq4repair_space>name<seq2seq4repair_space>'%s'<seq2seq4repair_space>" + "with<seq2seq4repair_space>enhanced<seq2seq4repair_space>class<seq2seq4repair_space>name<seq2seq4repair_space>'%s'" ) , entry . getKey ( ) , configClass . getName ( ) , enhancedClass . getName ( ) ) ) ; } beanDef . setBeanClass ( enhancedClass ) ; } } catch ( Throwable ex ) { throw new IllegalStateException ( ( "Cannot<seq2seq4repair_space>load<seq2seq4repair_space>configuration<seq2seq4repair_space>class:<seq2seq4repair_space>" + ( beanDef . getBeanClassName ( ) ) ) , ex ) ; } } } private static class ImportAwareBeanPostProcessor implements BeanFactoryAware , BeanPostProcessor , PriorityOrdered { private BeanFactory beanFactory ; public void setBeanFactory ( BeanFactory beanFactory ) throws BeansException { } public Object postProcessBeforeInitialization ( Object bean , String beanName ) throws BeansException { } public Object postProcessAfterInitialization ( Object bean , String beanName ) throws BeansException { } public int getOrder ( ) { } } }

Fix:
ConfigurationClassEnhancer enhancer = new ConfigurationClassEnhancer ( ) ;