CORE-57 - Surface javac diagnostics for runtime compile failures#180
CORE-57 - Surface javac diagnostics for runtime compile failures#180sam-ross wants to merge 3 commits into
Conversation
KealanTolandChronicle
left a comment
There was a problem hiding this comment.
Overall looks good, just one small comment about thread safety string appending, approved!
benbonavia
left a comment
There was a problem hiding this comment.
Please reduce the complexity as per the sonar analysis
|
Hi @benbonavia, this is ready for re-review. I’ve refactored the method Sonar flagged at loadFromJava(...). The cache lookup, file-manager lookup, compile-result validation, class definition loop, class-file writing, and final lookup are now split into private helpers. The public method is now a short orchestration path, while preserving the existing synchronisation and duplicate-definition guard behaviour. |
|



CORE-57 - Surface javac diagnostics for runtime compile failures
Summary
Surfaces javac diagnostics directly when runtime compilation fails, instead of masking the real compile failure as a generated-class
ClassNotFoundException.Context
CachedCompiler.compileFromJava(...)returns an empty map when javac fails. Previously,CachedCompiler.loadFromJava(...)did not distinguish that failure from a successful compile with no classes to define, and still calledclassLoader.loadClass(className).With module-style classloaders, this can produce a misleading
ClassNotFoundExceptionfor the generated class name, hiding the actual javac diagnostics such as missing symbols or unresolved types.Changes
CompilationResultpath inCachedCompiler.compileFromJava(...)behavior.PrintWriter.loadFromJava(...)to throw diagnosticClassNotFoundExceptionimmediately when javac compilation fails.defineClass(...)instead of falling through toclassLoader.loadClass(...).Verification