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