Skip to content

Commit a0212a4

Browse files
committed
Fix UnsupportedOperationException caused by Delombok's Sourcepath scanning and relax exit code 1 handling for robust extraction
1 parent 39903b2 commit a0212a4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/java/com/neuvem/java2graph/passes/DelombokPass.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,11 @@ public void execute(Java2GraphConfig config, GraphContext context) throws Except
158158

159159
// Phase 3 & 4: Application command and options
160160
command.add("delombok");
161+
command.add("-q"); // Suppress Javac diagnostic output that can crash the runner
161162
command.add("-d");
162163
command.add(targetDir.toAbsolutePath().toString());
163-
command.add("-s");
164-
command.add(globalSourcePath.toString());
164+
// Intentionally not passing -s globalSourcePath to prevent JavaCompiler from
165+
// implicitly reading and crashing on unparsable dependencies from other roots.
165166
command.add("-c");
166167
command.add(fullClassPath.toString());
167168
command.add("--nocopy");
@@ -188,10 +189,9 @@ public void execute(Java2GraphConfig config, GraphContext context) throws Except
188189

189190
int exitCode = process.waitFor();
190191
if (exitCode != 0) {
191-
String errorMsg = "Delombok failed for root " + relativePath + " with exit code " + exitCode + ".\n" +
192-
"Full command output:\n" + taskOutput;
193-
System.err.println(" [Lombok] ERROR: " + errorMsg);
194-
throw new RuntimeException("Delombok failed. Check logs for details.");
192+
System.err.println(" [Lombok] WARNING: Delombok reported compilation errors for root " + relativePath + " (exit code " + exitCode + "). Output will normally be best-effort.");
193+
// We intentionally DO NOT throw an exception here because Delombok correctly generates
194+
// output files even when Javac encounters missing symbols or unresolved dependencies.
195195
}
196196
Files.deleteIfExists(javaFilesListFile);
197197
}

0 commit comments

Comments
 (0)