Repository navigation
Translators: a printer's AssertionError is recorded as a crash, as the other errors are - #143
Merged
Merged
Conversation
…e other errors are KotlinTranslator and CSharpTranslator record a crash of the printer on one compilation unit and go on with the others, for a RuntimeException and a StackOverflowError. An AssertionError, thrown when the JVM runs with assertions enabled (-ea, as the tests do), escaped instead and ended the whole translation. Elsewhere in maddi, a catch that takes StackOverflowError takes AssertionError too (KotlinNullability, JavaInspectorImpl, ResolverImpl). With assertions enabled, the J2K and J2C# ratchets now count such a failure as a crash of that unit instead of failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A33UTsWTyE5kyknvBfqHC5 Signed-off-by: Tom Tourwe <Tom.Tourwe@codelaser.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
KotlinTranslatorandCSharpTranslatorrecord a crash of the printer on one compilation unit and go on with the others. They catchRuntimeExceptionandStackOverflowError, but notAssertionError:When the JVM runs with assertions enabled (
-ea, as the tests do), an assertion that fails while one unit is printed escaped and ended the whole translation, instead of being recorded as a crash of that unit as the class documentation describes ("A crash of the printer on one compilation unit is recorded and the others go on").Consistency
In
devel(1ce51a4), these two catches are the only ones that takeStackOverflowErrorwithoutAssertionError. Every other such catch, 22 in 10 files, takes all three:catch (RuntimeException | AssertionError | StackOverflowError e). This PR makes the translators consistent with them:maddi-cst-print-kotlin/.../KotlinNullability.javamaddi-inspection-openjdk/.../JavaInspectorImpl.javamaddi-inspection-parser/.../ResolverImpl.javamaddi-java-bytecode/.../ByteCodeInspectorImpl.javamaddi-java-openjdk/.../ClassSymbolScanner.javamaddi-java-openjdk/.../ScanCompilationUnit.javamaddi-java-openjdk/.../ScanCompilationUnits.javamaddi-java-parser/.../ParseTypeDeclaration.javamaddi-run-main/.../RunAnalyzer.javamaddi-run-openjdk/.../RunAnalyzer.javaAfter this PR, no catch in maddi takes
StackOverflowErrorwithoutAssertionError.Effect to be aware of
With assertions enabled, the J2K and J2C# ratchets (which call these translators) now count such a failure as a crash of that unit instead of failing. Without
-eanothing changes.Not built locally; two-line change.
🤖 Generated with Claude Code