oracle/graal · error · AssertionError

Unsupported type hierarchy for type literal.

Error message

Unsupported type hierarchy for type literal.

What it means

Error "Unsupported type hierarchy for type literal." thrown in oracle/graal.

Source

Thrown at espresso/src/com.oracle.truffle.espresso.polyglot/src/com/oracle/truffle/espresso/polyglot/TypeLiteral.java:101

        rawType = (Class<T>) extractRawType(guestType);
    }

    public Class<T> getRawType() {
        return rawType;
    }

    private static Type extractLiteralGuestType(@SuppressWarnings("rawtypes") Class<? extends TypeLiteral> literalClass) {
        Type superType = literalClass.getGenericSuperclass();
        Type typeArgument;
        while (true) {
            if (superType instanceof ParameterizedType) {
                ParameterizedType parametrizedType = (ParameterizedType) superType;
                if (parametrizedType.getRawType() == TypeLiteral.class) {
                    // found
                    typeArgument = parametrizedType.getActualTypeArguments()[0];
                    break;
                } else {
                    throw new AssertionError("Unsupported type hierarchy for type literal.");
                }
            } else if (superType instanceof Class<?>) {
                if (superType == TypeLiteral.class) {
                    typeArgument = Object.class;
                    break;
                } else {
                    superType = ((Class<?>) superType).getGenericSuperclass();
                }
            } else {
                throw new AssertionError("Unsupported type hierarchy for type literal.");
            }
        }
        return typeArgument;
    }

    private static Class<?> extractRawType(Type type) {
        Class<?> rawType;
        if (type instanceof Class) {

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Unsupported type hierarchy for type literal.
  2. Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call.

Example fix

Validate inputs and environment so that the failing condition does not occur: Unsupported type hierarchy for type literal.

When it happens

Trigger: Thrown at espresso/src/com.oracle.truffle.espresso.polyglot/src/com/oracle/truffle/espresso/polyglot/TypeLiteral.java:101 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Unsupported type hierarchy for type literal.


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/e90991330d1b3dad. Report an issue: GitHub.