JetBrains/intellij-community · error · CodeGenerationException
Class not found:
Error message
Class not found:
What it means
AsmCodeGenerator.getComponentClass catches ClassNotFoundException from InstrumentationClassFinder.loadClass and rethrows it as CodeGenerationException('Class not found: ' + className). The GUI Forms bytecode generator could not locate a component class on the instrumentation classpath while compiling a .form.
Source
Thrown at java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java:244
public byte[] getPatchedData() {
return myPatchedData;
}
static void pushPropValue(GeneratorAdapter generator, String propertyClass, Object value) {
PropertyCodeGenerator codeGen = myPropertyCodeGenerators.get(propertyClass);
if (codeGen == null) {
throw new RuntimeException("Unknown property class " + propertyClass);
}
codeGen.generatePushValue(generator, value);
}
static InstrumentationClassFinder.PseudoClass getComponentClass(String className, final InstrumentationClassFinder finder) throws CodeGenerationException {
try {
return finder.loadClass(className);
}
catch (ClassNotFoundException e) {
throw new CodeGenerationException(null, "Class not found: " + className);
}
catch(UnsupportedClassVersionError e) {
throw new CodeGenerationException(null, "Unsupported class version error: " + className);
}
catch (IOException e) {
throw new CodeGenerationException(null, e.getMessage(), e);
}
}
public static Type typeFromClassName(final String className) {
return Type.getType("L" + className.replace('.', '/') + ";");
}
class FormClassVisitor extends ClassVisitor implements GetFontMethodProvider {
private String myClassName;
private String mySuperName;
private final Map<String, String> myFieldDescMap = new HashMap<>();
private final Map<String, Integer> myFieldAccessMap = new HashMap<>();View on GitHub (pinned to be881553f2)
Solutions
- Add the missing library/module dependency so the component class is on the compile classpath
- Rebuild the module containing the component (class may simply not be compiled yet); a full Rebuild often clears it
- Fix the class name in the .form file if the component was renamed/moved (check the form XML's component class attribute)
- If it appears only after upgrades, clear build caches (System|Local History unrelated; use File > Invalidate Caches) and rebuild
Defensive patterns
Strategy: try-catch
Validate before calling
try { Class.forName(className, false, loader); } catch (ClassNotFoundException e) { /* resolve dependency before compiling forms */ } Try / catch
catch (CodeGenerationException e) if message starts with 'Class not found:': read the class name, verify module dependencies, then rebuild
Prevention
- Declare every custom component library as a module dependency before authoring forms
- Build dependent modules first (or use full Rebuild) when forms reference sibling-module classes
- Run rename refactoring (not text edits) so form XML class references stay valid
When it happens
Trigger: Compiling/instrumenting a form whose component (or a class referenced by it, e.g. a custom bean or nested form's class) is not on the finder's classpath: missing dependency JAR, class not yet compiled, wrong class name in the .form XML.
Common situations: Building a module before its dependencies; custom Swing components in a library not added to the module dependencies; obfuscated/renamed classes after a refactor; forms referencing classes moved to another module; running instrumentation with a stale compile output.
Related errors
- Unsupported class version error:
- Attempt to compile nested form with no nested form loader sp
- No binding on root component of nested form
- Recursive form nesting is not allowed
- Invalid input: {input}
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/8c6ef2ae68076ec2.
Report an issue: GitHub.