Buggy code:
class ConfigurationClassParser { private final MetadataReaderFactory metadataReaderFactory ; private final ProblemReporter problemReporter ; private final ConfigurationClassParser . ImportStack importStack = new ConfigurationClassParser . ImportStack ( ) ; private final Set < ConfigurationClass > configurationClasses = new LinkedHashSet < ConfigurationClass > ( ) ; private final Stack < PropertySource < ? > > propertySources = new Stack < PropertySource < ? > > ( ) ; private final Environment environment ; private final ResourceLoader resourceLoader ; private final BeanDefinitionRegistry registry ; private final ComponentScanAnnotationParser componentScanParser ; public ConfigurationClassParser ( MetadataReaderFactory metadataReaderFactory , ProblemReporter problemReporter , Environment environment , ResourceLoader resourceLoader , BeanDefinitionRegistry registry ) { } public void parse ( String className , String beanName ) throws IOException { } public void parse ( Class < ? > clazz , String beanName ) throws IOException { } protected void processConfigurationClass ( ConfigurationClass configClass ) throws IOException { } protected void doProcessConfigurationClass ( ConfigurationClass configClass , AnnotationMetadata metadata ) throws IOException { for ( String memberClassName : metadata . getMemberClassNames ( ) ) { MetadataReader reader = this . metadataReaderFactory . getMetadataReader ( memberClassName ) ; AnnotationMetadata memberClassMetadata = reader . getAnnotationMetadata ( ) ; if ( ConfigurationClassUtils . isConfigurationCandidate ( memberClassMetadata ) ) { processConfigurationClass ( new ConfigurationClass ( reader , null ) ) ; } } Map < String , Object > propertySourceAttributes = metadata . getAnnotationAttributes ( PropertySource . class . getName ( ) ) ; if ( propertySourceAttributes != null ) { String name = ( ( String ) ( propertySourceAttributes . get ( "name" ) ) ) ; String [ ] locations = ( ( String [ ] ) ( propertySourceAttributes . get ( "value" ) ) ) ; ClassLoader classLoader = this . resourceLoader . getClassLoader ( ) ; for ( String location : locations ) { location = this . environment . resolveRequiredPlaceholders ( location ) ; ResourcePropertySource ps = ( StringUtils . hasText ( name ) ) ? new ResourcePropertySource ( name , location , classLoader ) : new ResourcePropertySource ( location , classLoader ) ; this . propertySources . push ( ps ) ; } } Map < String , Object > componentScanAttributes = metadata . getAnnotationAttributes ( ComponentScan . class . getName ( ) ) ; if ( componentScanAttributes != null ) { Set < BeanDefinitionHolder > scannedBeanDefinitions = this . componentScanParser . parse ( componentScanAttributes ) ; for ( BeanDefinitionHolder holder : scannedBeanDefinitions ) { if ( ConfigurationClassUtils . checkConfigurationClassCandidate ( holder . getBeanDefinition ( ) , metadataReaderFactory ) ) { try { this . parse ( holder . getBeanDefinition ( ) . getBeanClassName ( ) , holder . getBeanName ( ) ) ; } catch ( ConflictingBeanDefinitionException ex ) { throw new CircularComponentScanException ( ( "A<seq2seq4repair_space>conflicting<seq2seq4repair_space>bean<seq2seq4repair_space>definition<seq2seq4repair_space>was<seq2seq4repair_space>detected<seq2seq4repair_space>while<seq2seq4repair_space>processing<seq2seq4repair_space>@ComponentScan<seq2seq4repair_space>annotations.<seq2seq4repair_space>" + "This<seq2seq4repair_space>usually<seq2seq4repair_space>indicates<seq2seq4repair_space>a<seq2seq4repair_space>circle<seq2seq4repair_space>between<seq2seq4repair_space>scanned<seq2seq4repair_space>packages." ) , ex ) ; } } } } <START_BUG> List < Map < String , Object > > allImportAttribs = AnnotationUtils . findAllAnnotationAttributes ( Import . class , metadata . getClassName ( ) , true ) ; <END_BUG> for ( Map < String , Object > importAttribs : allImportAttribs ) { processImport ( configClass , ( ( String [ ] ) ( importAttribs . get ( "value" ) ) ) , true ) ; } if ( metadata . isAnnotated ( ImportResource . class . getName ( ) ) ) { String [ ] resources = ( ( String [ ] ) ( metadata . getAnnotationAttributes ( ImportResource . class . getName ( ) ) . get ( "value" ) ) ) ; Class < ? > readerClass = ( ( Class < ? > ) ( metadata . getAnnotationAttributes ( ImportResource . class . getName ( ) ) . get ( "reader" ) ) ) ; if ( readerClass == null ) { throw new IllegalStateException ( ( "No<seq2seq4repair_space>reader<seq2seq4repair_space>class<seq2seq4repair_space>associated<seq2seq4repair_space>with<seq2seq4repair_space>imported<seq2seq4repair_space>resources:<seq2seq4repair_space>" + ( StringUtils . arrayToCommaDelimitedString ( resources ) ) ) ) ; } for ( String resource : resources ) { configClass . addImportedResource ( resource , readerClass ) ; } } Set < MethodMetadata > beanMethods = metadata . getAnnotatedMethods ( Bean . class . getName ( ) ) ; for ( MethodMetadata methodMetadata : beanMethods ) { configClass . addBeanMethod ( new BeanMethod ( methodMetadata , configClass ) ) ; } } private void processImport ( ConfigurationClass configClass , String [ ] classesToImport , boolean checkForCircularImports ) throws IOException { } public void validate ( ) { } public Set < ConfigurationClass > getConfigurationClasses ( ) { } public Stack < PropertySource < ? > > getPropertySources ( ) { } public ConfigurationClassParser . ImportRegistry getImportRegistry ( ) { } interface ImportRegistry { String getImportingClassFor ( String importedClass ) { } } @ SuppressWarnings ( "serial" ) private static class ImportStack extends Stack < ConfigurationClass > implements ConfigurationClassParser . ImportRegistry { private Map < String , String > imports = new HashMap < String , String > ( ) ; public String getImportingClassFor ( String importedClass ) { } public void registerImport ( String importingClass , String importedClass ) { } @ Override public boolean contains ( Object elem ) { } @ Override public String toString ( ) { } } private static class CircularImportProblem extends Problem { public CircularImportProblem ( ConfigurationClass attemptedImport , Stack < ConfigurationClass > importStack , AnnotationMetadata metadata ) { } } }

Fix:
List < Map < String , Object > > allImportAttribs = AnnotationUtils . findAllAnnotationAttributes ( Import . class , metadata . getClassName ( ) , true , metadataReaderFactory ) ;