Source:
<code>private void addField(Field field, EntityProjection parentProjection) { Class<?> parentType = parentProjection.getType(); String fieldName = field.getName(); if (entityDictionary.getRelationshipType(parentType, fieldName) != RelationshipType.NONE) { final Class<?> relationshipType = <START> entityDictionary.getParameterizedType(parentType, fieldName) == null <END> ? entityDictionary.getType(parentType, fieldName) : entityDictionary.getParameterizedType(parentType, fieldName); EntityProjection relationshipProjection = createProjection(relationshipType, field); parentProjection.getRelationships().put(fieldName, relationshipProjection); return; } Class<?> attributeType = entityDictionary.getType(parentType, fieldName); if (attributeType != null) { Set<Attribute> attributes = parentProjection.getAttributes(); Attribute matched = parentProjection.getAttributeByName(fieldName); if (matched == null) { attributes.add(Attribute.builder().type(attributeType).name(fieldName).build()); parentProjection.setAttributes(attributes); } } else { throw new InvalidEntityBodyException( String.format("Unknown attribute field {%s.%s}.", parentProjection.getName(), fieldName)); } }</code><technical_language>This check for null necessary. getParameterized type return correct type of type is parameterized</technical_language>

Target:
private void addField(Field field, EntityProjection parentProjection) { Class<?> parentType = parentProjection.getType(); String fieldName = field.getName(); if (entityDictionary.getRelationshipType(parentType, fieldName) != RelationshipType.NONE) { final Class<?> relationshipType = entityDictionary.getParameterizedType(parentType, fieldName); EntityProjection relationshipProjection = createProjection(relationshipType, field); Relationship relationship = Relationship.builder() .name(fieldName) .alias(field.getAlias()) .projection(relationshipProjection) .build(); relationshipMap.put(field.getSourceLocation(), relationship); parentProjection.getRelationships().add(relationship); return; } if (TYPENAME.equals(fieldName)) { return; } if (PAGE_INFO.equals(fieldName)) { if (field.getSelectionSet().getSelections().stream() .anyMatch(selection -> selection instanceof Field && PAGE_INFO_TOTAL_RECORDS.equals(((Field) selection).getName()))) { addPageTotal(parentProjection); } return; } Class<?> attributeType = entityDictionary.getType(parentType, fieldName); if (attributeType != null) { Set<Attribute> attributes = parentProjection.getAttributes(); Attribute matched = parentProjection.getAttributeByName(fieldName); if (matched == null) { attributes.add( Attribute.builder() .type(attributeType) .name(fieldName) .arguments( field.getArguments().stream() .map(graphQLArgument -> com.yahoo.elide.request.Argument.builder() .name(graphQLArgument.getName()) .value( variableResolver.resolveValue( graphQLArgument.getValue())) .build()) .collect(Collectors.toList())) .build()); parentProjection.setAttributes(attributes); } else { if (matched.getArguments().isEmpty() && matched.getArguments() == Collections.EMPTY_SET) { matched.setArguments(new HashSet<>()); } field.getArguments().forEach( graphQLArgument -> matched.getArguments().add( com.yahoo.elide.request.Argument.builder() .name(graphQLArgument.getName()) .value(variableResolver.resolveValue(graphQLArgument.getValue())) .build())); } } else { throw new InvalidEntityBodyException( String.format( "Unknown attribute field {%s.%s}.", entityDictionary.getJsonAliasFor(parentProjection.getType()), fieldName)); } }