Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 631565ab authored by Mathieu Chartier's avatar Mathieu Chartier Committed by Gerrit Code Review
Browse files

Merge "Change getDeclaredFieldsUnchecked call to new return value"

parents a01250c7 3d529c5b
Loading
Loading
Loading
Loading
+15 −23
Original line number Diff line number Diff line
@@ -1005,30 +1005,22 @@ public class ViewDebug {
            return fields;
        }

        final ArrayList<Field> declaredFields = new ArrayList();
        klass.getDeclaredFieldsUnchecked(false, declaredFields);

        final ArrayList<Field> foundFields = new ArrayList<Field>();
        final int count = declaredFields.size();
        for (int i = 0; i < count; i++) {
            final Field field = declaredFields.get(i);

            // Ensure the field type can be resolved.
        try {
                field.getType();
            } catch (NoClassDefFoundError e) {
                continue;
            }

            if (field.isAnnotationPresent(ExportedProperty.class)) {
            final Field[] declaredFields = klass.getDeclaredFieldsUnchecked(false);
            final ArrayList<Field> foundFields = new ArrayList<Field>();
            for (final Field field : declaredFields) {
              // Fields which can't be resolved have a null type.
              if (field.getType() != null && field.isAnnotationPresent(ExportedProperty.class)) {
                  field.setAccessible(true);
                  foundFields.add(field);
                  sAnnotations.put(field, field.getAnnotation(ExportedProperty.class));
              }
            }

            fields = foundFields.toArray(new Field[foundFields.size()]);
            map.put(klass, fields);
        } catch (NoClassDefFoundError e) {
            throw new AssertionError(e);
        }

        return fields;
    }