@@ -86,27 +86,37 @@ public static void registerConstructorsForReflection(FeatureAccess access, Strin
8686 }
8787 }
8888
89+ /** Registers an entire class for reflection use. */
90+ public static void registerClassForReflection (Class <?> clazz ) {
91+ RuntimeReflection .register (clazz );
92+ RuntimeReflection .register (clazz .getDeclaredConstructors ());
93+ RuntimeReflection .register (clazz .getDeclaredFields ());
94+ RuntimeReflection .register (clazz .getDeclaredMethods ());
95+ }
96+
8997 /** Registers an entire class for reflection use. */
9098 public static void registerClassForReflection (FeatureAccess access , String name ) {
9199 Class <?> clazz = access .findClassByName (name );
92100 if (clazz != null ) {
93- RuntimeReflection .register (clazz );
94- RuntimeReflection .register (clazz .getDeclaredConstructors ());
95- RuntimeReflection .register (clazz .getDeclaredFields ());
96- RuntimeReflection .register (clazz .getDeclaredMethods ());
101+ registerClassForReflection (clazz );
97102 } else {
98103 LOGGER .log (Level .WARNING , CLASS_REFLECTION_ERROR_MESSAGE , name );
99104 }
100105 }
101106
107+ /** Registers an entire class for JNI use. */
108+ public static void registerClassForJni (Class <?> clazz ) {
109+ RuntimeJNIAccess .register (clazz );
110+ RuntimeJNIAccess .register (clazz .getDeclaredConstructors ());
111+ RuntimeJNIAccess .register (clazz .getDeclaredFields ());
112+ RuntimeJNIAccess .register (clazz .getDeclaredMethods ());
113+ }
114+
102115 /** Registers an entire class for JNI use. */
103116 public static void registerClassForJni (FeatureAccess access , String name ) {
104117 Class <?> clazz = access .findClassByName (name );
105118 if (clazz != null ) {
106- RuntimeJNIAccess .register (clazz );
107- RuntimeJNIAccess .register (clazz .getDeclaredConstructors ());
108- RuntimeJNIAccess .register (clazz .getDeclaredFields ());
109- RuntimeJNIAccess .register (clazz .getDeclaredMethods ());
119+ registerClassForJni (clazz );
110120 } else {
111121 LOGGER .log (Level .WARNING , CLASS_REFLECTION_ERROR_MESSAGE , name );
112122 }
0 commit comments