Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
snicoll opened this issue Oct 13, 2023 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Oct 13, 2023

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

@snicoll snicoll added type: bug A general bug theme: aot An issue related to Ahead-of-time processing labels Oct 13, 2023
@snicoll snicoll added this to the 6.1.0-RC2 milestone Oct 13, 2023
@snicoll snicoll self-assigned this Oct 13, 2023
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants