Skip to content

Assisted Configuration agent does not consider META-INF/native-image files #3968

Open
@raphw

Description

@raphw

I have added a native-image.properties file to my library to specify that its static initializers are to be run at build-time, not at runtime, as this is safe.

When running the assisted configuration agent, this agent detects all code that is run from these static initialization blocks and adds entries to reflect-config.json, whereas those entries are obsolete due to the static blocks being executed during build time. To make things worse, as there are classes generated in the static blocks, these classes cannot be found statically during the native-image phase, what fails the build if those entries are not manually removed. After removal from the generated reflect-config.json, everything works as expected.

During native-image execution, the native-image.properties file is respected, and I would expect that the agent makes the same consideration as the file is available from the libraries jar file.

I would suggest that the assisted support agent should scan for native-image.properties files available and check the stack trace to find if a discovery is triggered from a static initializer block, to then exclude such a discovery if the native-image.properties file suggests that the package is initialized at build time.

Does this sound like a reasonable extension?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions