quarkusio/quarkus · error · IllegalArgumentException
Type is not parameterized:
Error message
Type is not parameterized:
What it means
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.
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.
Example fix
// before
class MySupplier implements Supplier {
}
// after
class MySupplier implements Supplier<String> {
} Defensive patterns
Strategy: type-guard
Validate before calling
static boolean isParameterized(java.lang.reflect.Type t) {
return t instanceof ParameterizedType && ((ParameterizedType) t).getActualTypeArguments().length > 0;
} Type guard
if (type instanceof ParameterizedType) { Type arg = ((ParameterizedType) type).getActualTypeArguments()[idx]; } Try / catch
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; } Prevention
- Parameterize generic interfaces (Supplier<T>, Comparable<T>) with concrete types
- Use TypeLiteral to preserve generics under erasure
- Avoid getClass()-based reflection on generic instances
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Type has no raw type class:
- Unable to find type arguments of
- Endpoint return type not supported yet
- Invalid signature char
- Invalid type variable in signature
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/7ac6167dee91a738.
Report an issue: GitHub.
Appendix: source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/util/ReflectUtil.java:103
return NO_CLASSES;
}
Type t;
Class<?> r;
for (int i = 0; i < types.length; i++) {
t = types[i];
r = rawTypeOf(t);
if (r != t) {
types[i] = r;
}
}
return Arrays.copyOf(types, types.length, Class[].class);
}
public static Type typeOfParameter(final Type type, final int paramIdx) {
if (type instanceof ParameterizedType) {
return ((ParameterizedType) type).getActualTypeArguments()[paramIdx];
} else {
throw new IllegalArgumentException("Type is not parameterized: " + type);
}
}
public static Class<?> rawTypeOfParameter(final Type type, final int paramIdx) {
return rawTypeOf(typeOfParameter(type, paramIdx));
}
public static void setFieldVal(Field field, Object obj, Object value) {
try {
field.set(obj, value);
} catch (IllegalAccessException e) {
throw toError(e);
}
}
public static <T> T newInstance(Class<T> clazz) {
try {
return clazz.getConstructor().newInstance();View on GitHub (pinned to e1c734241f)