Finds all the visible fields declared or inherited in the target class
173815
public static List<VarSymbol> findAllFields(Type classType, VisitorState state) {
    // TODO(andrewrice): Switch collector to ImmutableList.toImmutableList() when released
    return state.getTypes().closure(classType).stream()
        .flatMap(
            type -> {
              TypeSymbol tsym = type.tsym;
              if (tsym == null) {
                return ImmutableList.<VarSymbol>of().stream();
              }
              WriteableScope scope = tsym.members();
              if (scope == null) {
                return ImmutableList.<VarSymbol>of().stream();
              }
              return ImmutableList.copyOf(scope.getSymbols(VarSymbol.class::isInstance)).reverse()
                  .stream()
                  .map(v -> (VarSymbol) v)
                  .filter(v -> isVisible(v, state.getPath()));
            })
        .collect(Collectors.toCollection(ArrayList::new));
  }
772068
public static Field[] getAllDeclaredFields(Class<?> clazz) {
		Field[] declaredFields = clazz.getDeclaredFields();
		Class<?> superClass = clazz.getSuperclass();
		if (superClass != null && superClass != Object.class) {
			declaredFields = ArrayUtil.concat(declaredFields, getAllDeclaredFields(superClass));
		}
		return declaredFields;
	}
1147780
private Map<String, Field> getAllFields(Class<?> type) {
        Map<String, Field> fields = new HashMap<String, Field>();
        for (Class<?> c = type; c != null; c = c.getSuperclass()) {
            for(Field f : c.getDeclaredFields()) {
                fields.put(f.getName(), f);
            }
        }
        return fields;
    }
690218
def get_fields_by_class(cls, field_class):
        

        ret = []

        for key, val in getattr(cls, '_fields').items():
            if isinstance(val, field_class):
                ret.append(key)
        return ret
622588
public static void getFields (Class<?> clazz, List<Field> addTo)
    {
        // first get the fields of the superclass
        Class<?> pclazz = clazz.getSuperclass();
        if (pclazz != null && !pclazz.equals(Object.class)) {
            getFields(pclazz, addTo);
        }

        // then reflect on this class's declared fields
        Field[] fields;
        try {
            fields = clazz.getDeclaredFields();
        } catch (SecurityException se) {
            System.err.println("Unable to get declared fields of " + clazz.getName() + ": " + se);
            fields = new Field[0];
        }

        // override the default accessibility check for the fields
        try {
            AccessibleObject.setAccessible(fields, true);
        } catch (SecurityException se) {
            // ah well, only publics for us
        }

        for (Field field : fields) {
            int mods = field.getModifiers();
            if (Modifier.isStatic(mods) || Modifier.isTransient(mods)) {
                continue; // skip static and transient fields
            }
            addTo.add(field);
        }
    }
1245678
private static Field[] getBurstableFields(Class<?> cls) {
    final List<Field> fields = new ArrayList<>();

    for (Field field : getAllFields(cls)) {
      if (field.isAnnotationPresent(Burst.class)) {

        if (Modifier.isStatic(field.getModifiers())) {
          throw new IllegalStateException("Burstable field must not be static: " + field.getName());
        }

        if (Modifier.isFinal(field.getModifiers())) {
          throw new IllegalStateException("Burstable field must not be final: " + field.getName());
        }

        fields.add(field);
      }
    }

    return fields.toArray(new Field[fields.size()]);
  }
851710
def get_rendered_fields(self, ctx=None):
        '''
        
        '''
        times = self._min_times
        if self._mutating() and self._in_repeat_stage():
            times += (self._current_index) * self._step
        return super(Repeat, self).get_rendered_fields(ctx) * times
724209
def get_declared_fields(bases, attrs):
    

    def is_field(prop):
        return isinstance(prop, forms.Field) or \
            isinstance(prop, BaseRepresentation)

    fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if is_field(obj)]
    # add fields from base classes:
    for base in bases[::-1]:
        if hasattr(base, 'base_fields'):
            fields = base.base_fields.items() + fields
    return dict(fields)
491362
def _get_fields_for_class(schema_graph, graphql_types, field_type_overrides, hidden_classes,
                          cls_name):
    """"""
    properties = schema_graph.get_element_by_class_name(cls_name).properties

    # Add leaf GraphQL fields (class properties).
    all_properties = {
        property_name: _property_descriptor_to_graphql_type(property_obj)
        for property_name, property_obj in six.iteritems(properties)
    }
    result = {
        property_name: graphql_representation
        for property_name, graphql_representation in six.iteritems(all_properties)
        if graphql_representation is not None
    }

    # Add edge GraphQL fields (edges to other vertex classes).
    schema_element = schema_graph.get_element_by_class_name(cls_name)
    outbound_edges = (
        ('out_{}'.format(out_edge_name),
         schema_graph.get_element_by_class_name(out_edge_name).properties[
             EDGE_DESTINATION_PROPERTY_NAME].qualifier)
        for out_edge_name in schema_element.out_connections
    )
    inbound_edges = (
        ('in_{}'.format(in_edge_name),
         schema_graph.get_element_by_class_name(in_edge_name).properties[
             EDGE_SOURCE_PROPERTY_NAME].qualifier)
        for in_edge_name in schema_element.in_connections
    )
    for field_name, to_type_name in chain(outbound_edges, inbound_edges):
        edge_endpoint_type_name = None
        subclasses = schema_graph.get_subclass_set(to_type_name)

        to_type_abstract = schema_graph.get_element_by_class_name(to_type_name).abstract
        if not to_type_abstract and len(subclasses) > 1:
            # If the edge endpoint type has no subclasses, it can't be coerced into any other type.
            # If the edge endpoint type is abstract (an interface type), we can already
            # coerce it to the proper type with a GraphQL fragment. However, if the endpoint type
            # is non-abstract and has subclasses, we need to return its subclasses as an union type.
            # This is because GraphQL fragments cannot be applied on concrete types, and
            # GraphQL does not support inheritance of concrete types.
            type_names_to_union = [
                subclass
                for subclass in subclasses
                if subclass not in hidden_classes
            ]
            if type_names_to_union:
                edge_endpoint_type_name = _get_union_type_name(type_names_to_union)
        else:
            if to_type_name not in hidden_classes:
                edge_endpoint_type_name = to_type_name

        if edge_endpoint_type_name is not None:
            # If we decided to not hide this edge due to its endpoint type being non-representable,
            # represent the edge field as the GraphQL type List(edge_endpoint_type_name).
            result[field_name] = GraphQLList(graphql_types[edge_endpoint_type_name])

    for field_name, field_type in six.iteritems(field_type_overrides):
        if field_name not in result:
            raise AssertionError(u'Attempting to override field "{}" from class "{}", but the '
                                 u'class does not contain said field'.format(field_name, cls_name))
        else:
            result[field_name] = field_type

    return result
899815
public static List<Field> getAnnotatedFields(final Class<?> cls, final Class<? extends Annotation> annotationClass) {

        final List<Field> fieldList = new ArrayList<>();

        for (final Field f : cls.getDeclaredFields()) {
            if (f.getAnnotation(annotationClass) != null) {
                fieldList.add(f);
            }
        }

        // Add super class methods
        if (cls.getSuperclass() != null) {
            fieldList.addAll(getAnnotatedFields(cls.getSuperclass(), annotationClass));
        }

        return fieldList;
    }
289019
private static Set<ClassTemplateSpec> findAllReferencedTypes(
      Set<ClassTemplateSpec> current,
      Set<ClassTemplateSpec> visited,
      Set<ClassTemplateSpec> acc) {

    //val nextUnvisited = current.flatMap(_.directReferencedTypes).filterNot(visited.contains);
    Set<ClassTemplateSpec> nextUnvisited = new HashSet<ClassTemplateSpec>();
    for (ClassTemplateSpec currentSpec: current) {
      for (ClassTemplateSpec maybeNext: directReferencedTypes(currentSpec)) {
        if (!visited.contains(maybeNext)) {
          nextUnvisited.add(maybeNext);
        }
      }
    }

    Set<ClassTemplateSpec> accAndCurrent = new HashSet<ClassTemplateSpec>(acc);
    accAndCurrent.addAll(current);

    if (nextUnvisited.size() > 0) {
      Set<ClassTemplateSpec> currentAndVisited = new HashSet<ClassTemplateSpec>(current);
      currentAndVisited.addAll(visited);

      return findAllReferencedTypes(nextUnvisited, currentAndVisited, accAndCurrent);
    } else {
      return accAndCurrent;
    }
  }
1366332
public static Field getDeclaredFieldSilent(Class<?> target, String fieldName) {
		try {
			return target.getDeclaredField(fieldName);
		} catch (Exception e) {
			return null;
		}
	}
189121
private Set<String> collectFields(Class clazz, String fieldPrefix, Set<String> fields) {
        Map<String, Class> fieldsAndClasses = getFieldsAndClasses(clazz, fieldPrefix);

        for (Map.Entry<String, Class> entry : fieldsAndClasses.entrySet()) {
            String field = entry.getKey();
            Class fieldClass = entry.getValue();

            if (DIRECTLY_PROJECTED_TYPES.contains(fieldClass) || Collection.class.isAssignableFrom(fieldClass)) {
                fields.add(field);
            } else {
                collectFields(fieldClass, field + ".", fields);
            }
        }

        return fields;
    }
631320
@Override
  public FieldVisitor visitField(int access,
                                 String name,
                                 String description,
                                 String signature,
                                 Object value) {
    assert (currentClass != null);
    if (signature == null)
      signature = description + " " + name;
    return currentClass.visitField(access, name, description,
        signature, value);
  }
526935
void checkFields(ClassFile cf) throws ConstantPoolException {
        for (Field f : cf.fields) {
            String type = nameFromDescType(cf.constant_pool.getUTF8Value(f.descriptor.index));
            if (type != null) {
                DeprData dd = db.getTypeDeprecated(type);
                if (dd != null) {
                    printHasField(cf, f.getName(cf.constant_pool), type, dd.isForRemoval());
                }
            }
        }
    }
130864
def visit_field_class(self, item, descriptor=None, fields=None):
        """"""
        discovered_fields = collections.OrderedDict()
        field_groups = {}
        for node in item.body:
            if isinstance(node, ast.ClassDef):
                field_groups[node.name] = self.visit_field_class(node)
                continue

            if not isinstance(node, ast.Assign):
                continue
            if not isinstance(node.value, ast.Call):
                continue
            if not isinstance(node.targets[0], ast.Name):
                continue

            # Build accessible symbols table.
            symtable = {}
            # All field types.
            symtable.update({
                field.__name__: field
                for field in get_available_fields()
            })
            # Field group classes.
            symtable.update(field_groups)

            evaluator = SafeEvaluator(symtable=symtable)

            name = node.targets[0].id
            try:
                field = evaluator.run(node.value)
            except Exception as ex:
                # TODO: Handle errors.
                raise ex

            if descriptor is not None:
                field.contribute_to_class(descriptor, fields, name)
            else:
                discovered_fields[name] = field

        if descriptor is None:
            class Fields:
                """Fields wrapper."""

            for name, field in discovered_fields.items():
                setattr(Fields, name, field)

            return Fields
20733
private Set<String> getTheMissingFields(Set<String> locatedTargets) {
        Set<String> missing = new HashSet<>();
        for (String target : getNeeded()) {
            if (!locatedTargets.contains(target)) {
                // Handle wildcard targets differently
                if (target.endsWith("*")) {
                    if (target.endsWith(".*")) {
                        if (!locatedTargets.contains(target.substring(0, target.length() - 2))) {
                            missing.add(target);
                        }
                    }
                    // Else: it ends with :* and it is always "present".
                } else {
                    missing.add(target);
                }
            }
        }
        return missing;
    }