oracle/graal · error · IllegalArgumentException
Expected enum annotation array element, got {}
Error message
Expected enum annotation array element, got {} What it means
Error "Expected enum annotation array element, 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:765
* 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);
}
}
if (componentType.isEnum()) {
JavaConstant enumClass = access.getProviders().getConstantReflection().asJavaClass(componentType);
ResolvedJavaType stringType = access.getProviders().getMetaAccess().lookupJavaType(String.class);
JavaConstant[] constantNames = new JavaConstant[values.size()];
for (int i = 0; i < values.size(); i++) {
if (!(values.get(i) instanceof EnumElement enumElement)) {
throw new IllegalArgumentException("Expected enum annotation array element, got " + values.get(i));
}
if (!componentType.equals(enumElement.enumType)) {
throw new IllegalArgumentException("Unexpected enum type: " + enumElement.enumType.toJavaName());
}
constantNames[i] = access.getProviders().getConstantReflection().forString(enumElement.name);
}
JavaConstant namesArray = access.asArrayConstant(stringType, constantNames);
return access.invoke(access.com_oracle_truffle_espresso_vmaccess_guest_GuestAnnotationProxyBuilder_enumArray, null, enumClass, namesArray);
}
JavaConstant[] elements = new JavaConstant[values.size()];
for (int i = 0; i < values.size(); i++) {
elements[i] = toGuestAnnotationMemberValue(values.get(i), componentType, true, annotationClass, memberName);
}
return access.asArrayConstant(componentType, elements);
}
// Guest -> Host
private MethodHandle getArgumentFilter(JavaType guestType, ResolvedJavaType accessingClass, Class<?> hostType) {View on GitHub (pinned to a66e9ccd1d)
Solutions
- Fix the condition reported by the error: Expected enum annotation array element, got {}
- 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 enum annotation array element, got {} When it happens
Trigger: Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:765 when the library encounters an invalid state.
Common situations: Occurs when a caller violates the contract guarded by this check: Expected enum annotation array element, got {}
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/d1549e72c9fbe5a1.
Report an issue: GitHub.