{"record":{"id":"9b06d3902be2942e","repo":"projectlombok/lombok","slug":"delombok-option-module-path-requires-usage-of-j","errorCode":null,"errorMessage":"DELOMBOK: Option --module-path requires usage of JDK9 or higher.","messagePattern":"DELOMBOK: Option --module-path requires usage of JDK9 or higher\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/delombok/lombok/delombok/Delombok.java","lineNumber":733,"sourceCode":"\t\t\t\targsList.add((modulepath == null || modulepath.isEmpty()) ? pathToSelfJar : (pathToSelfJar + File.pathSeparator + modulepath));\n\t\t\t} else if (modulepath != null && !modulepath.isEmpty()) {\n\t\t\t\targsList.add(\"--module-path\");\n\t\t\t\targsList.add(modulepath);\n\t\t\t}\n\t\t\t\n\t\t\tif (!disablePreview && Javac.getJavaCompilerVersion() >= 11) argsList.add(\"--enable-preview\");\n\t\t\tif (Javac.getJavaCompilerVersion() >= 21) argsList.add(\"-proc:full\");\n\t\t\t\n\t\t\tif (Javac.getJavaCompilerVersion() < 15) {\n\t\t\t\tString[] argv = argsList.toArray(new String[0]);\n\t\t\t\targs.init(\"javac\", argv);\n\t\t\t} else {\n\t\t\t\targs.init(\"javac\", argsList);\n\t\t\t}\n\t\t\toptions.put(\"diags.legacy\", \"TRUE\");\n\t\t\toptions.put(\"allowStringFolding\", \"FALSE\");\n\t\t} else {\n\t\t\tif (modulepath != null && !modulepath.isEmpty()) throw new IllegalStateException(\"DELOMBOK: Option --module-path requires usage of JDK9 or higher.\");\n\t\t}\n\t\t\n\t\tCommentCatcher catcher = CommentCatcher.create(context, Javac.getJavaCompilerVersion() >= 13);\n\t\tJavaCompiler compiler = catcher.getCompiler();\n\t\t\n\t\tList<JCCompilationUnit> roots = new ArrayList<JCCompilationUnit>();\n\t\tMap<JCCompilationUnit, File> baseMap = new IdentityHashMap<JCCompilationUnit, File>();\n\t\t\n\t\tSet<AbstractProcessor> processors = new LinkedHashSet<AbstractProcessor>();\n\t\tprocessors.addAll(preLombokProcessors);\n\t\tprocessors.add(new lombok.javac.apt.LombokProcessor());\n\t\tprocessors.addAll(additionalAnnotationProcessors);\n\t\t\n\t\tif (Javac.getJavaCompilerVersion() >= 9) {\n\t\t\tJavaFileManager jfm_ = context.get(JavaFileManager.class);\n\t\t\tif (jfm_ instanceof BaseFileManager) {\n\t\t\t\tArguments args = Arguments.instance(context);\n\t\t\t\t((BaseFileManager) jfm_).setContext(context); // reinit with options","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/delombok/lombok/delombok/Delombok.java#L715-L751","documentation":"Delombok's `--module-path` option only exists on JDK 9+, where the module system (JPMS) was introduced. When delombok runs on JDK 8 or lower and a non-empty module path was configured, it throws IllegalStateException because javac 8 has no module-path concept to forward.","triggerScenarios":"Calling `delombok.setModulepath(...)` (or passing `--module-path` on the CLI) and then running `delombok()` on a runtime JDK whose version is below 9. The check fires in the non-JDK9 branch of the compile setup inside `delombok()`.","commonSituations":"Builds pinned to JDK 8 (common for legacy projects) whose build script copies module-path settings from a JDK 11+ config; switching CI agents to an older JDK while the Ant/Maven config still sets modulepath.","solutions":["Run delombok on JDK 9 or higher (update JAVA_HOME / toolchain)","Remove the `--module-path` option or the `setModulepath` call when targeting JDK 8","Only set modulepath conditionally, e.g. when `System.getProperty(\"java.version\")` indicates 9+"],"exampleFix":"// before\ndelombok.setModulepath(modulePath); // fails on JDK 8\n// after\nif (Runtime.version().feature() >= 9) delombok.setModulepath(modulePath); // or simply drop the line on JDK 8","handlingStrategy":"validation","validationCode":"int ver = Integer.parseInt(System.getProperty(\"java.version\").split(\"\\\\.\")[0]);\nif (ver >= 9 && modulePath != null) delombok.setModulepath(modulePath);","typeGuard":null,"tryCatchPattern":"try { delombok.delombok(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"JDK9\")) { /* rerun on JDK 9+ or drop modulepath */ } throw e; }","preventionTips":["Pin delombok runs to JDK 9+ when using module-path","Gate modulepath config on java.version detection","Keep JDK 8 build profiles free of module-path settings"],"tags":["jdk","java-versions","module-path","delombok"],"backgroundTag":"unsupported-operation","analyzedSha":"6d6a3e9fec0a9555702561fbeb8eac836575116e","analyzedAt":"2026-09-07T23:18:01.841Z","contentChangedAt":"2026-09-07T23:18:01.841Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}