oracle/graal · error · IllegalArgumentException
--java.SpecCompliance: Mode can be 'strict' or 'hotspot'.
Error message
--java.SpecCompliance: Mode can be 'strict' or 'hotspot'.
What it means
The OptionType converter for the --java.SpecCompliance option tries SpecComplianceMode.valueOf(s.toUpperCase()) and wraps any IllegalArgumentException when the string is neither 'strict' nor 'hotspot' (case-insensitive). The option controls whether Espresso mimics HotSpot behavior on points where it deviates from the JVMS.
Source
Thrown at espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoOptions.java:286
return new ArrayList<>(Arrays.asList(strings.split(File.pathSeparator)));
}
private static List<String> splitBySemiColon(String strings) {
return new ArrayList<>(Arrays.asList(strings.split(EspressoOptions.SEMI_COLON)));
}
public enum SpecComplianceMode {
STRICT,
HOTSPOT
}
private static final OptionType<SpecComplianceMode> SPEC_COMPLIANCE_OPTION_TYPE = new OptionType<>("SpecCompliance", new Function<String, SpecComplianceMode>() {
@Override
public SpecComplianceMode apply(String s) {
try {
return SpecComplianceMode.valueOf(s.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("--java.SpecCompliance: Mode can be 'strict' or 'hotspot'.");
}
}
});
@Option(help = "Force mimicking of hotspot behavior on unrespected specs points", //
category = OptionCategory.EXPERT, //
stability = OptionStability.EXPERIMENTAL, //
usageSyntax = "hotspot|strict") //
public static final OptionKey<SpecComplianceMode> SpecCompliance = new OptionKey<>(SpecComplianceMode.HOTSPOT, SPEC_COMPLIANCE_OPTION_TYPE);
public enum VerifyMode {
NONE,
REMOTE, // Verifies all bytecodes not loaded by the bootstrap class loader.
ALL
}
private static final OptionType<VerifyMode> VERIFY_MODE_OPTION_TYPE = new OptionType<>("VerifyMode", new Function<String, VerifyMode>() {
@OverrideView on GitHub (pinned to a66e9ccd1d)
Solutions
- Use exactly --java.SpecCompliance=strict or --java.SpecCompliance=hotspot (case-insensitive).
- Remove the flag to keep the default value, which is hotspot.
- Check mx/graalvm flag documentation for the current option name and allowed values.
Example fix
# before --java.SpecCompliance=default # after --java.SpecCompliance=strict
Defensive patterns
Strategy: validation
Validate before calling
// Java launcher
if (!List.of("strict", "hotspot").contains(specCompliance.toLowerCase(Locale.ROOT))) {
throw new ConfigException("SpecCompliance must be strict|hotspot");
} Type guard
static boolean validSpecCompliance(String s) {
return s != null && s.matches("(?i)(strict|hotspot)");
} Prevention
- Whitelist option values at config load time.
- Print the accepted set in your tool's --help.
- Fail fast at startup rather than deep inside the Truffle option parser.
When it happens
Trigger: Passing --java.SpecCompliance=<value> (or context option java.SpecCompliance) where value is anything other than strict/hotspot, e.g. 'default', 'true', 'STRICT ' with trailing space.
Common situations: Copy-pasting JVM flags that have no Espresso equivalent; typos in CI launch configuration; scripts written against a different GraalVM version where accepted values differ.
Related errors
- -Xverify: Mode can be 'none', 'remote' or 'all'.
- --java.LivenessAnalysis can only be 'none'|'false', 'auto' o
- Not starting with digits: {size}
- Unit prefix can be at most one character: {size}
- Unrecognized unit prefix: {size} use `T`, `G`, `M`, or `k`.
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/6444081039fcf4dc.
Report an issue: GitHub.