quarkusio/quarkus · error · IllegalArgumentException

Our supertype instance does not match supertype declared ar

Error message

Our supertype instance  does not match supertype declared arguments: 

What it means

JandexUtil.mapTypeArguments maps type arguments returned from a supertype traversal back down onto the applied (parameterized) type. If the number of applied arguments collected does not match the number of type parameters declared on the supertype, the hierarchy is inconsistent (e.g. raw type vs parameterized mismatch) and it throws IllegalArgumentException("Our supertype instance X does not match supertype declared arguments: Y").

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java:211

        // we passed them explicitly
        if (appliedType.kind() == Kind.PARAMETERIZED_TYPE) {
            appliedArguments = appliedType.asParameterizedType().arguments();
        } else {
            // raw supertype: use bounds
            appliedArguments = new ArrayList<>(superType.typeParameters().size());
            for (TypeVariable typeVariable : superType.typeParameters()) {
                if (!typeVariable.bounds().isEmpty()) {
                    appliedArguments.add(typeVariable.bounds().get(0));
                } else {
                    appliedArguments.add(ClassType.create(DOTNAME_OBJECT, Kind.CLASS));
                }
            }
        }

        // it's a problem if we got different arguments to the parameters declared
        if (appliedArguments.size() != superType.typeParameters().size()) {
            throw new IllegalArgumentException("Our supertype instance " + appliedType
                    + " does not match supertype declared arguments: " + superType.typeParameters());
        }
        // build the mapping
        Map<String, Type> mapping = new HashMap<>();
        for (int i = 0; i < superType.typeParameters().size(); i++) {
            TypeVariable typeParameter = superType.typeParameters().get(i);
            mapping.put(typeParameter.identifier(), appliedArguments.get(i));
        }
        // and map
        return mapGenerics(typeArgumentsFromSupertype, mapping);
    }

    private static boolean containsTypeParameters(List<Type> typeArgumentsFromSupertype) {
        for (Type type : typeArgumentsFromSupertype) {
            if (containsTypeParameters(type)) {
                return true;
            }
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the offending class hierarchy so the generic supertype is properly parametrized (e.g. class Foo extends Bar<String> instead of raw Bar)
  2. Identify the class via the appliedType in the message and check its generic signature with javap -v
  3. Work around by resolving the type arguments yourself via Jandex superClassType().asParameterizedType().arguments() and custom mapping logic
  4. Report upstream if caused by a Jandex parsing edge case (include the class and its signature)

Example fix

// before
class MyRepo extends BaseRepo { }        // raw supertype
// after
class MyRepo extends BaseRepo<User> { }  // explicit type arguments
Defensive patterns

Strategy: try-catch

Validate before calling

// verify applied supertype is fully parameterized before resolving
if (supertype.kind() != org.jboss.jandex.Type.Kind.PARAMETERIZED_TYPE) {
    throw new IllegalStateException("Raw supertype cannot map generic arguments: " + supertype);
}

Type guard

static boolean isFullyParameterized(org.jboss.jandex.Type t) {
    return t.kind() == org.jboss.jandex.Type.Kind.PARAMETERIZED_TYPE;
}

Try / catch

try {
    List<Type> args = JandexUtil.resolveTypeParameters(input, target, index);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Our supertype instance")) {
        // hierarchy has a raw/mismatched parameterized supertype — inspect superClassType()
        throw new IllegalStateException("Raw supertype in hierarchy of " + input, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling JandexUtil.resolveTypeParameters where the class hierarchy contains a raw or malformed parameterized supertype reference — a class extending a generic class without type arguments whose bounds cannot supply a full argument list, or corrupted/edge-case Jandex type data (e.g. generic signatures with fewer type arguments than declared parameters).

Common situations: Libraries compiled with unusual generics usage (raw types in bytecode) that Jandex models without arguments; bytecode processed by tools that drop generic signatures; edge cases with inner classes and owners.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/fbc93630ef09b4b9. Report an issue: GitHub.