oracle/graal · error · IllegalArgumentException

Expected resolved annotation member type, got {}

Error message

Expected resolved annotation member type, got {}

What it means

Error "Expected resolved annotation member type, got {}" thrown in oracle/graal.

Source

Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:739

     * guest exception proxy.
     */
    private JavaConstant guestEnumValue(EnumElement enumElement, JavaType expectedType) {
        ResolvedJavaType enumType = enumElement.enumType;
        if (!(expectedType instanceof ResolvedJavaType expectedEnumType) || !expectedEnumType.equals(enumType)) {
            throw new IllegalArgumentException("Unexpected enum type: " + enumType.toJavaName());
        }
        JavaConstant enumClass = access.getProviders().getConstantReflection().asJavaClass(enumType);
        JavaConstant enumName = access.getProviders().getConstantReflection().forString(enumElement.name);
        return access.invoke(access.com_oracle_truffle_espresso_vmaccess_guest_GuestAnnotationProxyBuilder_enumValue, null, enumClass, enumName);
    }

    /**
     * Converts a nested annotation value after verifying its concrete type against the enclosing
     * member declaration.
     */
    private JavaConstant guestAnnotationValue(AnnotationValue annotationValue, JavaType expectedType) {
        if (!(expectedType instanceof ResolvedJavaType expectedAnnotationType)) {
            throw new IllegalArgumentException("Expected resolved annotation member type, got " + expectedType);
        }
        validateAnnotationType(expectedAnnotationType, annotationValue.getAnnotationType(), "annotation member type");
        return createGuestAnnotation(annotationValue);
    }

    /**
     * Constructs a typed guest annotation array, promoting any deferred element failure to the
     * member-level exception proxy required by the JDK annotation handler.
     */
    private JavaConstant guestArrayValue(List<?> values, JavaType expectedType, JavaConstant annotationClass, JavaConstant memberName) {
        if (!(expectedType instanceof ResolvedJavaType arrayType) || !arrayType.isArray()) {
            throw new IllegalArgumentException("Expected array annotation member type, got " + expectedType);
        }
        ResolvedJavaType componentType = arrayType.getComponentType();
        for (Object value : values) {
            if (value instanceof ErrorElement) {
                return toGuestAnnotationMemberValue(value, componentType, true, annotationClass, memberName);
            }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Expected resolved annotation member type, got {}
  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: Expected resolved annotation member type, got {}

When it happens

Trigger: Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:739 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Expected resolved annotation member type, got {}


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