@@ -161,18 +161,12 @@ public static void registerPreservedClasses(NativeImageClassLoaderSupport classL
161
161
* registration.
162
162
*/
163
163
classesToPreserve .forEach (c -> {
164
- reflection .register (always , false , c );
165
-
166
- reflection .registerAllDeclaredFields (always , c );
167
- reflection .registerAllDeclaredMethodsQuery (always , false , c );
168
- reflection .registerAllDeclaredConstructorsQuery (always , false , c );
169
- reflection .registerAllConstructorsQuery (always , false , c );
170
- reflection .registerAllClassesQuery (always , c );
171
- reflection .registerAllDeclaredClassesQuery (always , c );
172
- reflection .registerAllNestMembersQuery (always , c );
173
- reflection .registerAllPermittedSubclassesQuery (always , c );
174
- reflection .registerAllRecordComponentsQuery (always , c );
175
- reflection .registerAllSignersQuery (always , c );
164
+ registerType (reflection , c );
165
+
166
+ /* Register array types for each type up to dimension 2 */
167
+ Class <?> arrayType = c .arrayType ();
168
+ registerType (reflection , arrayType );
169
+ registerType (reflection , arrayType .arrayType ());
176
170
177
171
/* Register every single-interface proxy */
178
172
// GR-62293 can't register proxies from jdk modules.
@@ -230,4 +224,20 @@ public static void registerPreservedClasses(NativeImageClassLoaderSupport classL
230
224
reflection .registerClassLookup (always , className );
231
225
}
232
226
}
227
+
228
+ private static void registerType (RuntimeReflectionSupport reflection , Class <?> c ) {
229
+ ConfigurationCondition always = ConfigurationCondition .alwaysTrue ();
230
+ reflection .register (always , false , c );
231
+
232
+ reflection .registerAllDeclaredFields (always , c );
233
+ reflection .registerAllDeclaredMethodsQuery (always , false , c );
234
+ reflection .registerAllDeclaredConstructorsQuery (always , false , c );
235
+ reflection .registerAllConstructorsQuery (always , false , c );
236
+ reflection .registerAllClassesQuery (always , c );
237
+ reflection .registerAllDeclaredClassesQuery (always , c );
238
+ reflection .registerAllNestMembersQuery (always , c );
239
+ reflection .registerAllPermittedSubclassesQuery (always , c );
240
+ reflection .registerAllRecordComponentsQuery (always , c );
241
+ reflection .registerAllSignersQuery (always , c );
242
+ }
233
243
}
0 commit comments