{"record":{"id":"adc24e9d20622aa6","repo":"apache/dubbo","slug":"unrecognized-type-fieldtype-tostring","errorCode":null,"errorMessage":"Unrecognized Type: ${fieldType.toString()}","messagePattern":"Unrecognized Type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java","lineNumber":855,"sourceCode":"            Object fieldObject = getFieldObject(mapObject, type);\n            field.set(instance, fieldObject);\n        }\n\n        return instance;\n    }\n\n    private static Object getFieldObject(Object mapObject, Type fieldType) throws ReflectiveOperationException {\n        if (fieldType instanceof Class<?>) {\n            return convertClassType(mapObject, (Class<?>) fieldType);\n        } else if (fieldType instanceof ParameterizedType) {\n            return convertParameterizedType(mapObject, (ParameterizedType) fieldType);\n        } else if (fieldType instanceof GenericArrayType\n                || fieldType instanceof TypeVariable<?>\n                || fieldType instanceof WildcardType) {\n            // ignore these type currently\n            return null;\n        } else {\n            throw new IllegalArgumentException(\"Unrecognized Type: \" + fieldType.toString());\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private static Object convertClassType(Object mapObject, Class<?> type) throws ReflectiveOperationException {\n        if (type.isPrimitive() || isAssignableFrom(type, mapObject.getClass())) {\n            return mapObject;\n        } else if (Objects.equals(type, String.class) && CLASS_CAN_BE_STRING.contains(mapObject.getClass())) {\n            // auto convert specified type to string\n            return mapObject.toString();\n        } else if (mapObject instanceof Map) {\n            return mapToPojo((Map<String, Object>) mapObject, type);\n        } else {\n            // type didn't match and mapObject is not another Map struct.\n            // we just ignore this situation.\n            return null;\n        }\n    }","sourceCodeStart":837,"sourceCodeEnd":873,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java#L837-L873","documentation":"PojoUtils.getFieldObject dispatches on the concrete subtype of java.lang.reflect.Type. It handles Class, ParameterizedType, GenericArrayType, TypeVariable, and WildcardType explicitly. Any other Type implementation falls through to a default that throws IllegalArgumentException. This is a defensive guard against encountering a Type subtype the library was not designed for.","triggerScenarios":"Calling PojoUtils during realization where a field's generic type resolves to an unusual or custom Type implementation not covered by the five standard JDK subtypes. This is extremely rare in practice since the JDK only produces those five types from standard reflection APIs.","commonSituations":"Almost never encountered under normal usage. Could theoretically occur with a custom Type implementation injected via bytecode manipulation or a non-standard reflection library. More likely indicates a bug in how generic type information was extracted or a JDK edge case in type resolution for complex nested generics.","solutions":["Inspect the fieldType.toString() value in the exception message to identify the unrecognized Type implementation.","Check if the field uses an exotic generic construct or a third-party annotation processor that generated custom Type metadata.","Simplify the field's generic declaration to a standard form (e.g. replace a complex self-referential generic with a concrete type).","If this is a Dubbo bug for a legitimate JDK Type, report it with the field declaration and the fieldType class name."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return PojoUtils.realize(pojo, type, genericType);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Unrecognized Type\")) {\n        logger.warn(\"Field type {} not supported by PojoUtils, skipping field\",\n            e.getMessage());\n        return pojo; // return as-is or use a custom converter\n    }\n    throw e;\n}","preventionTips":["Use standard JDK generic constructs (Class, ParameterizedType) in field declarations.","Avoid custom Type implementations or exotic generic patterns in Dubbo-serialized DTOs.","If you encounter this, simplify the field's generic type to a concrete class."],"tags":["pojo","reflection","generics","type-resolution"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}