JetBrains/intellij-community · error · CodeGenerationException

Unsupported class version error:

Error message

Unsupported class version error: 

What it means

getComponentClass catches UnsupportedClassVersionError and rethrows CodeGenerationException('Unsupported class version error: ' + className). A class was found on the instrumentation classpath but its bytecode version is newer than the JVM/classpath context performing forms compilation can accept.

Source

Thrown at java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java:247

  }

  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<>();
    private boolean myHaveCreateComponentsMethod = false;
    private int myCreateComponentsAccess;
    private final boolean myExplicitSetupCall;

View on GitHub (pinned to be881553f2)

Solutions

  1. Align bytecode versions: build dependencies with a target <= the JDK used for forms compilation/instrumentation
  2. Upgrade the runtime/IDE JDK to one that understands the dependency's class file version
  3. Downgrade the dependency to a version compatible with your toolchain
  4. Check Module SDK and Project bytecode target settings for mismatches
Defensive patterns

Strategy: try-catch

Validate before calling

int major = readClassFileMajorVersion(dependencyJarEntry); // reject if > runtime JDK's supported version before building

Try / catch

catch (CodeGenerationException e) if message starts with 'Unsupported class version error': identify the JAR/class, then align JDK target or upgrade the runtime

Prevention

When it happens

Trigger: A dependency JAR containing the form's component class was compiled with a newer JDK target (e.g. class file 65 from JDK 21) while the build/instrumentation runs on an older JDK or older ASM-aware pipeline.

Common situations: Upgrading a library that ships Java-21 bytecode while the IDE/module still compiles on JDK 17; mixed toolchains where dependencies are built by a newer CI JDK; setting --release lower than a dependency's bytecode; running an older IDE version with newer project bytecode.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/5f286d6605cbd962. Report an issue: GitHub.