Skip to content

Commit 10a4e88

Browse files
jhoellerunknown
authored andcommitted
polishing
1 parent 282d961 commit 10a4e88

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,13 @@ private void processImport(ConfigurationClass configClass, String[] classesToImp
315315
AnnotationMetadata importingClassMetadata = configClass.getMetadata();
316316
for (String candidate : classesToImport) {
317317
MetadataReader reader = this.metadataReaderFactory.getMetadataReader(candidate);
318-
if (new AssignableTypeFilter(ImportSelector.class).match(reader, metadataReaderFactory)) {
318+
if (new AssignableTypeFilter(ImportSelector.class).match(reader, this.metadataReaderFactory)) {
319319
// the candidate class is an ImportSelector -> delegate to it to determine imports
320320
try {
321321
ImportSelector selector = BeanUtils.instantiateClass(Class.forName(candidate), ImportSelector.class);
322322
processImport(configClass, selector.selectImports(importingClassMetadata), false);
323-
} catch (ClassNotFoundException ex) {
323+
}
324+
catch (ClassNotFoundException ex) {
324325
throw new IllegalStateException(ex);
325326
}
326327
}
@@ -329,7 +330,8 @@ else if (new AssignableTypeFilter(ImportBeanDefinitionRegistrar.class).match(rea
329330
try {
330331
ImportBeanDefinitionRegistrar registrar = BeanUtils.instantiateClass(Class.forName(candidate), ImportBeanDefinitionRegistrar.class);
331332
registrar.registerBeanDefinitions(importingClassMetadata, registry);
332-
} catch (ClassNotFoundException ex) {
333+
}
334+
catch (ClassNotFoundException ex) {
333335
throw new IllegalStateException(ex);
334336
}
335337
}
@@ -367,21 +369,22 @@ public ImportRegistry getImportRegistry() {
367369

368370

369371
interface ImportRegistry {
372+
370373
String getImportingClassFor(String importedClass);
371374
}
372375

373376

374377
@SuppressWarnings("serial")
375378
private static class ImportStack extends Stack<ConfigurationClass> implements ImportRegistry {
376379

377-
private Map<String, String> imports = new HashMap<String, String>();
380+
private final Map<String, String> imports = new HashMap<String, String>();
378381

379-
public String getImportingClassFor(String importedClass) {
380-
return imports.get(importedClass);
382+
public void registerImport(String importingClass, String importedClass) {
383+
this.imports.put(importedClass, importingClass);
381384
}
382385

383-
public void registerImport(String importingClass, String importedClass) {
384-
imports.put(importedClass, importingClass);
386+
public String getImportingClassFor(String importedClass) {
387+
return this.imports.get(importedClass);
385388
}
386389

387390
/**

0 commit comments

Comments
 (0)