private void fillDataTypes() {
        for (var schema : orderedInput) {
            var doc = schema.getDocument();
            for (var annotation : doc.getAnnotations()) {
                var at = findAnnotationFromParsed(annotation);
                for (var parent : annotation.getResolvedInherits()) {
                    at.inherit(findAnnotationFromParsed(parent));
                }
                fillAnnotationStruct(annotation);
            }
            for (var struct : doc.getStructs()) {
                var toFill = findStructFromParsed(struct);
                // evil ugliness
                for (ParsedField field : struct.getFields()) {
                    if (! field.hasIdOverride()) {
                        var t = resolveFromContext(field.getType(), doc);
                        var f = new com.yahoo.document.Field(field.name(), t);
                        toFill.addField(f);
                    }
                }
                for (ParsedField field : struct.getFields()) {
                    if (field.hasIdOverride()) {
                        var t = resolveFromContext(field.getType(), doc);
                        var f = new com.yahoo.document.Field(field.name(), field.idOverride(), t);
                        toFill.addField(f);
                    }
                }
                for (var inherit : struct.getResolvedInherits()) {
                    var parent = findStructFromParsed(inherit);
                    // ensure a nice, compatible exception message
                    for (var field : toFill.getFields()) {
                        if (parent.hasField(field)) {
                            for (var base : parent.getInheritedTypes()) {
                                if (base.hasField(field)) {
                                    parent = base;
                                }
                            }
                            throw new IllegalArgumentException
                                ("In document " + doc.name() + ": struct " + struct.name() +
                                 " cannot inherit from " + parent.getName() + " and redeclare field " + field.getName());
                        }
                    }
                    toFill.inherit(parent);
                }
            }
            var docToFill = documentsFromSchemas.get(doc.name());
            Map<String, Collection<String>> fieldSets = new HashMap<>();
            List<String> inDocFields = new ArrayList<>();
            for (var docField : doc.getFields()) {
                String name = docField.name();
                var t = resolveFromContext(docField.getType(), doc);
                var f = new com.yahoo.document.Field(docField.name(), t);
                docToFill.addField(f);
                if (docField.hasIdOverride()) {
                    f.setId(docField.idOverride(), docToFill);
                }
                inDocFields.add(name);
            }
            fieldSets.put("[document]", inDocFields);
            for (var extraField : schema.getFields()) {
                String name = extraField.name();
                if (docToFill.hasField(name)) continue;
                var t = resolveFromContext(extraField.getType(), doc);
                var f = new com.yahoo.document.Field(name, t);
                docToFill.addField(f);
            }
            for (var fieldset : schema.getFieldSets()) {
                fieldSets.put(fieldset.name(), fieldset.getFieldNames());
            }
            for (String inherit : doc.getInherited()) {
                docToFill.inherit(findDocFromSchemas(inherit));
            }
            docToFill.addFieldSets(fieldSets);
        }
    }
Helper class for converting ParsedType instances to DataType

@author arnej27959
config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedTypes.java