{"record":{"id":"7ac6167dee91a738","repo":"quarkusio/quarkus","slug":"type-is-not-parameterized","errorCode":null,"errorMessage":"Type is not parameterized: ","messagePattern":"Type is not parameterized: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/ReflectUtil.java","lineNumber":103,"sourceCode":"            return NO_CLASSES;\n        }\n        Type t;\n        Class<?> r;\n        for (int i = 0; i < types.length; i++) {\n            t = types[i];\n            r = rawTypeOf(t);\n            if (r != t) {\n                types[i] = r;\n            }\n        }\n        return Arrays.copyOf(types, types.length, Class[].class);\n    }\n\n    public static Type typeOfParameter(final Type type, final int paramIdx) {\n        if (type instanceof ParameterizedType) {\n            return ((ParameterizedType) type).getActualTypeArguments()[paramIdx];\n        } else {\n            throw new IllegalArgumentException(\"Type is not parameterized: \" + type);\n        }\n    }\n\n    public static Class<?> rawTypeOfParameter(final Type type, final int paramIdx) {\n        return rawTypeOf(typeOfParameter(type, paramIdx));\n    }\n\n    public static void setFieldVal(Field field, Object obj, Object value) {\n        try {\n            field.set(obj, value);\n        } catch (IllegalAccessException e) {\n            throw toError(e);\n        }\n    }\n\n    public static <T> T newInstance(Class<T> clazz) {\n        try {\n            return clazz.getConstructor().newInstance();","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/ReflectUtil.java#L85-L121","documentation":"ReflectUtil.typeOfParameter returns the nth actual type argument of a parameterized Type. If the Type is not a ParameterizedType (e.g. a plain Class because the type argument was erased or never supplied), it throws this IllegalArgumentException. This occurs in code that resolves generic parameters of supertypes, suppliers, optionals, etc.","triggerScenarios":"Calling typeOfParameter or rawTypeOfParameter with a raw Class instead of a ParameterizedType — e.g. implementing ConfigMapping/Supplier/Message of a generic type without providing actual type arguments, or reflecting on a raw-typed class reference.","commonSituations":"Classes implementing a generic interface raw (class Foo implements Supplier) — generics erased, no actual type arguments; Quarkus REST client or config resolution asking for a parameter's type of a non-generic type; passing getClass() of a generic instance.","solutions":["Make the implementing class parameterize the generic supertype: class Foo implements Supplier<String>.","Use a TypeLiteral/anonymous subclass to preserve generics at runtime.","Verify the type passed in is actually parameterized (parameterize any raw variables upstream).","Pre-check with instanceof ParameterizedType before calling typeOfParameter."],"exampleFix":"// before\nclass MySupplier implements Supplier {\n}\n// after\nclass MySupplier implements Supplier<String> {\n}","handlingStrategy":"type-guard","validationCode":"static boolean isParameterized(java.lang.reflect.Type t) {\n    return t instanceof ParameterizedType && ((ParameterizedType) t).getActualTypeArguments().length > 0;\n}","typeGuard":"if (type instanceof ParameterizedType) { Type arg = ((ParameterizedType) type).getActualTypeArguments()[idx]; }","tryCatchPattern":"try { Type t = ReflectUtil.typeOfParameter(type, 0); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Type is not parameterized\")) { /* parameterize the generic supertype */ } else throw e; }","preventionTips":["Parameterize generic interfaces (Supplier<T>, Comparable<T>) with concrete types","Use TypeLiteral to preserve generics under erasure","Avoid getClass()-based reflection on generic instances"],"tags":["reflection","generics","type-erasure"],"backgroundTag":"type-not-parameterized","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}