Skip to content

Conversation

graalvmbot
Copy link
Collaborator

Unregistered array instantiation is handled the same way as a missing method accessor (when trying to invoke a method registered as queried only): by throwing an error regardless of the value of the ThrowMissingRegistrationErrors flag.

Example error:

org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively instantiate the array class

   java.lang.String[]

 without it being registered for runtime reflection. Add java.lang.String[] to the reflection metadata to solve this problem. Note: Add "unsafeAllocated" to the array class registration to enable runtime instantiation. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.errorForArray(MissingReflectionRegistrationUtils.java:115)
	at java.base@23/java.lang.reflect.Array.multiNewArray(Array.java:410)
	at java.base@23/java.lang.reflect.Array.newInstance(Array.java:112)

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 26, 2024
@graalvmbot graalvmbot closed this Feb 26, 2024
@graalvmbot graalvmbot deleted the lottet/GR-51476-array-mre branch February 26, 2024 19:02
@graalvmbot graalvmbot merged commit c02fc6e into master Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants