Source:
<code>protected Object createAndFillObject(ObjectNode json, Object toReturn, String className, List<String> genericClasses) { Iterator<Map.Entry<String, JsonNode>> fields = json.fields(); int numberOfFields = json.size(); while (fields.hasNext()) { Map.Entry<String, JsonNode> element = fields.next(); String key = element.getKey(); JsonNode jsonNode = element.getValue(); if (numberOfFields == 1 && "value".equals(key)) { <START> return internalLiteralEvaluation(jsonNode.textValue(), genericClasses.isEmpty() ? String.class.getCanonicalName() : genericClasses.get(0)); <END> } if (jsonNode.isArray()) { List<Object> nestedList = new ArrayList<>(); Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); List<Object> returnedList = createAndFillList((ArrayNode) jsonNode, nestedList, fieldDescriptor.getKey(), fieldDescriptor.getValue()); setField(toReturn, key, returnedList); } else if (jsonNode.isObject()) { Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); Object nestedObject = createObject(fieldDescriptor.getKey(), fieldDescriptor.getValue()); Object returnedObject = createAndFillObject((ObjectNode) jsonNode, nestedObject, fieldDescriptor.getKey(), fieldDescriptor.getValue()); setField(toReturn, key, returnedObject); } else if (jsonNode.textValue() != null && !jsonNode.textValue().isEmpty()) { Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); setField(toReturn, key, internalLiteralEvaluation(jsonNode.textValue(), fieldDescriptor.getKey())); } else { } } return toReturn; }</code><technical_language>need cover kind of Map<String, SimpleType> Map<String, String>. btw if genericClasses is empty means is inconsistent, wrong happened (I guess code performed a wrong recursion?)</technical_language>

Target:
protected Object createAndFillObject(ObjectNode json, Object toReturn, String className, List<String> genericClasses) { Iterator<Map.Entry<String, JsonNode>> fields = json.fields(); while (fields.hasNext()) { Map.Entry<String, JsonNode> element = fields.next(); String key = element.getKey(); JsonNode jsonNode = element.getValue(); if (isSimpleTypeNode(jsonNode)) { Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); Object value = internalLiteralEvaluation(getSimpleTypeNodeTextValue(jsonNode), fieldDescriptor.getKey()); setField(toReturn, key, value); return toReturn; } if (jsonNode.isArray()) { List<Object> nestedList = new ArrayList<>(); Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); List<Object> returnedList = createAndFillList((ArrayNode) jsonNode, nestedList, fieldDescriptor.getKey(), fieldDescriptor.getValue()); setField(toReturn, key, returnedList); } else if (jsonNode.isObject()) { Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); Object nestedObject = createObject(fieldDescriptor.getKey(), fieldDescriptor.getValue()); Object returnedObject = createAndFillObject((ObjectNode) jsonNode, nestedObject, fieldDescriptor.getKey(), fieldDescriptor.getValue()); setField(toReturn, key, returnedObject); } else if (jsonNode.textValue() != null && !jsonNode.textValue().isEmpty()) { Map.Entry<String, List<String>> fieldDescriptor = getFieldClassNameAndGenerics(toReturn, key, className, genericClasses); setField(toReturn, key, internalLiteralEvaluation(jsonNode.textValue(), fieldDescriptor.getKey())); } else { } } return toReturn; }