oracle/graal · error · RuntimeException
Type with name %s not found.
Error message
Type with name %s not found.
What it means
APHotSpotSignature.resolveType converts a descriptor type ('LFoo/Bar;') to a TypeMirror via Elements.getTypeElement. If the element utilities cannot resolve the canonical name (returns null), it throws RuntimeException 'Type with name %s not found.' — meaning the referenced type is not on the annotation processor's classpath/round environment. Note the code first reports the name via env.getMessager().printMessage(Kind.ERROR, ...), so a compiler diagnostic precedes the exception.
Source
Thrown at compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/replacements/processor/APHotSpotSignature.java:145
}
}
String canonicalName = binaryName;
if (canonicalName.startsWith("L") && canonicalName.endsWith(";")) {
canonicalName = canonicalName.substring(1, canonicalName.length() - 1);
}
env.getMessager().printMessage(Kind.ERROR, canonicalName);
int arrayDims = 0;
while (canonicalName.startsWith("[")) {
canonicalName = canonicalName.substring(1, canonicalName.length());
arrayDims++;
}
canonicalName = canonicalName.replaceAll("/", ".");
TypeElement typeElement = env.getElementUtils().getTypeElement(canonicalName);
if (typeElement == null) {
throw new RuntimeException(String.format("Type with name %s not found.", canonicalName));
}
TypeMirror mirror = typeElement.asType();
for (int i = 0; i < arrayDims; i++) {
mirror = env.getTypeUtils().getArrayType(mirror);
}
return mirror;
}
/**
* Returns the kind from the character describing a primitive or void.
*
* @param ch the character
* @return the kind
*/
public static TypeKind fromPrimitiveOrVoidTypeChar(char ch) {
switch (ch) {
case 'Z':
return TypeKind.BOOLEAN;View on GitHub (pinned to a66e9ccd1d)
Solutions
- Verify the fully qualified name in the descriptor is spelled correctly with '/' separators converted properly (the code maps '/' to '.').
- Ensure the referenced type is on the annotation processor path: add the containing project/jar as a dependency of the suite that runs the processor (check mx suite deps).
- If the type lives in another compilation unit processed in a later round, restructure so it is available (API project or precompiled library).
- Replace the reference with a type that is guaranteed visible (e.g. jdk.internal.vm.compiler types) if the signature is only used for matching.
Example fix
// before // signature references a type not on the processor path "(Lcom/example/Missing;)V" // after // add dependency on the project containing com.example.Missing, or use a visible type "(Ljdk/internal/vm/compiler/word/Word;)V"
Defensive patterns
Strategy: try-catch
Validate before calling
Elements elements = processingEnv.getElementUtils();
TypeMirror resolveIfPresent(String canonicalName) {
String name = canonicalName.replace('/', '.');
while (name.startsWith("[")) {
name = name.substring(1);
}
TypeElement el = elements.getTypeElement(name);
return el == null ? null : el.asType(); // null => type not visible to this processor
} Try / catch
try {
TypeMirror t = sig.getParameterType(env, i);
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Type with name")) {
// the descriptor's class is not on the processor path: add the dependency
// or defer to a later processing round; do not retry unchanged
}
} Prevention
- Ensure every type referenced in substitution signatures is a declared dependency of the suite running the processor.
- Run mx build with the complete set of suite dependencies so the processor sees all target classes.
- Watch for the preceding Kind.ERROR messager diagnostic — it names the unresolved type before the exception.
When it happens
Trigger: A method-substitution signature references a type the processor cannot see: e.g. 'Lcom/foo/Bar;' where com.foo.Bar is not among the compiled sources or processor classpath. env.getElementUtils().getTypeElement(canonicalName) returns null at APHotSpotSignature.java:143-146 and the RuntimeException is thrown.
Common situations: Referencing JDK-internal or optional classes not visible to the processor; missing dependency in the mx suite distribution; typos in the '/'-separated name; splitting code across suites so the signature's target class is compiled in a later round; class-file-only deps not passed to the processor path.
Related errors
- Invalid trailing characters.
- Invalid character at index ${cur} in signature: ${signature}
- Class name "${className}" does not match pattern ${QUALIFIED
- Input list field must not be final
- Input list field must not be public
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/1f09424eb219bec6.
Report an issue: GitHub.