Skip to content

AOT processing fails to determine proper target for a FactoryBean that produces an array #31426

@snicoll

Description

@snicoll

SortedResourcesFactoryBean produces an object of type Resource[].class. When the default target is computed, there is this special case to extract the target type of the factory bean. Turns out that fails down the road due to:

Caused by: java.lang.IllegalArgumentException: array types cannot be represented as a ClassName
	at org.springframework.javapoet.Util.checkArgument(Util.java:53)
	at org.springframework.javapoet.ClassName.get(ClassName.java:166)
	at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.getTarget(DefaultBeanRegistrationCodeFragments.java:86)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:85)
	at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.generateValueCode(DefaultBeanRegistrationCodeFragments.java:189)
	at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.lambda$generateSetBeanDefinitionPropertiesCode$0(DefaultBeanRegistrationCodeFragments.java:175)
	at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.lambda$new$0(BeanDefinitionPropertiesCodeGenerator.java:102)
	at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:131)
	at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:101)
	... 65 more

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions