{"record":{"id":"c8ad43ba1075abcf","repo":"quarkusio/quarkus","slug":"type-type-name-tostring-which-is-used-in-c8ad43","errorCode":null,"errorMessage":"Type  + type.name().toString() +  which is used in class  + declaringClass +  must define a single generic argument","messagePattern":"Type  \\+ type\\.name\\(\\)\\.toString\\(\\) \\+  which is used in class  \\+ declaringClass \\+  must define a single generic argument","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigurationPropertiesUtil.java","lineNumber":194,"sourceCode":"        return DotNames.COLLECTION.equals(resultType.name()) ||\n                DotNames.LIST.equals(resultType.name()) ||\n                DotNames.SET.equals(resultType.name());\n    }\n\n    private static boolean isMap(final Type resultType) {\n        return DotNames.MAP.equals(resultType.name()) ||\n                DotNames.HASH_MAP.equals(resultType.name());\n    }\n\n    static Type determineSingleGenericType(Type type, DotName declaringClass) {\n        if (!(type.kind() == Type.Kind.PARAMETERIZED_TYPE)) {\n            throw new IllegalArgumentException(\"Type \" + type.name().toString() + \" which is used in class \" + declaringClass\n                    + \" must define a generic argument\");\n        }\n\n        ParameterizedType parameterizedType = type.asParameterizedType();\n        if (parameterizedType.arguments().size() != 1) {\n            throw new IllegalArgumentException(\"Type \" + type.name().toString() + \" which is used in class \" + declaringClass\n                    + \" must define a single generic argument\");\n        }\n\n        return type.asParameterizedType().arguments().get(0);\n    }\n\n    static void registerImplicitConverter(Type type, BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {\n        // We need to register for reflection in case an implicit converter is required.\n        if (!MicroProfileConfigProcessor.isHandledByProducers(type)) {\n            if (type.kind() != Type.Kind.ARRAY) {\n                reflectiveClasses\n                        .produce(ReflectiveClassBuildItem.builder(type.name().toString()).methods().build());\n            }\n        }\n    }\n}\n","sourceCodeStart":176,"sourceCodeEnd":211,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigurationPropertiesUtil.java#L176-L211","documentation":"Companion check in determineSingleGenericType: the type IS parameterized but declares more than one generic argument. Types used in this position must have exactly one type argument, otherwise IllegalArgumentException '... must define a single generic argument' is thrown.","triggerScenarios":"A @ConfigurationProperties property type like Map<String, String> (two type arguments) or Pair<A, B> is passed to determineSingleGenericType from the value-read generators, which expect single-argument types (List, Optional, Set).","commonSituations":"Using Map-typed properties through the path intended for List/Optional types; custom two-parameter generic types as property types.","solutions":["Use single-argument types (List<T>, Optional<T>, Set<T>) for such properties; handle Maps via the dedicated Map path with parameterized Map<K, V>.","Split multi-argument types into simpler properties.","Review which container type the getter returns and align it with the supported set."],"exampleFix":"// before\nPair<String, Integer> getRange();\n\n// after\nList<Integer> getRange(); // or a supported single-arg type","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static boolean isSingleArgContainer(java.lang.reflect.Type t) {\n  return t instanceof java.lang.reflect.ParameterizedType pt\n      && pt.getActualTypeArguments().length == 1;\n}","tryCatchPattern":null,"preventionTips":["Use List<T>/Optional<T>/Set<T> (one type argument) for these properties","Model key-value config with Map<String, V> via the dedicated Map path instead","Avoid custom multi-argument generic types in config members"],"tags":["quarkus","build-time","generics","type-arguments"],"backgroundTag":"unsupported-generic-arity","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}