@@ -205,20 +205,25 @@ private static ConstructorDescriptor getCtor(Class clazz) {
205205
206206 private static List <Binding > getFields (Map <String , Type > lookup , ClassInfo classInfo , boolean includingPrivate ) {
207207 ArrayList <Binding > bindings = new ArrayList <Binding >();
208- for (Field field : getAllFields (classInfo .clazz , includingPrivate )) {
208+ for (Field field : getAllFields (classInfo .clazz )) {
209209 if (Modifier .isStatic (field .getModifiers ())) {
210210 continue ;
211211 }
212- if (!includingPrivate && !Modifier .isPublic (field .getType ().getModifiers ())) {
213- continue ;
214- }
215212 if (includingPrivate ) {
216213 field .setAccessible (true );
217214 }
218215 if (isTransient (field .getModifiers ())) {
219216 continue ;
220217 }
221218 Binding binding = createBindingFromField (lookup , classInfo , field );
219+ if (!includingPrivate && !Modifier .isPublic (field .getModifiers ())) {
220+ binding .toNames = new String [0 ];
221+ binding .fromNames = new String [0 ];
222+ }
223+ if (!includingPrivate && !Modifier .isPublic (field .getType ().getModifiers ())) {
224+ binding .toNames = new String [0 ];
225+ binding .fromNames = new String [0 ];
226+ }
222227 bindings .add (binding );
223228 }
224229 return bindings ;
@@ -240,15 +245,12 @@ private static Binding createBindingFromField(Map<String, Type> lookup, ClassInf
240245 }
241246 }
242247
243- private static List <Field > getAllFields (Class clazz , boolean includingPrivate ) {
244- List <Field > allFields = Arrays .asList (clazz .getFields ());
245- if (includingPrivate ) {
246- allFields = new ArrayList <Field >();
247- Class current = clazz ;
248- while (current != null ) {
249- allFields .addAll (Arrays .asList (current .getDeclaredFields ()));
250- current = current .getSuperclass ();
251- }
248+ private static List <Field > getAllFields (Class clazz ) {
249+ ArrayList <Field > allFields = new ArrayList <Field >();
250+ Class current = clazz ;
251+ while (current != null ) {
252+ allFields .addAll (Arrays .asList (current .getDeclaredFields ()));
253+ current = current .getSuperclass ();
252254 }
253255 return allFields ;
254256 }
0 commit comments