Implement exception handling in java-slang - #96
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for compiling try-catch-finally statements, refactors the JVM's ExceptionTable to be iterable and use a dedicated class structure, and adds unit tests for exception routing. It also fixes a buffer offset calculation bug in the disassembler when reading code attributes. The reviewer identified several critical bugs in the TryStatement code generation implementation—including a pass-by-value bug with unresolved label offsets, an early return bug when catches are absent but a finally block is present, and incorrect execution paths for finally blocks—and provided a comprehensive rewrite to address these issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1148 tests passing in 65 suites. Report generated by 🧪jest coverage report action from df4fede |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for parsing and compiling Java try-catch-finally and throw statements, including AST extraction, code generation, and JVM exception table handling. Feedback on the changes identifies several critical issues: first, accessing finallyNode.blockStatements directly in the code generator will throw a runtime TypeError because finallyNode is of type Finally and its statements reside under finallyNode.block.blockStatements; second, the catch-all exception handler for the finally block is added before specific catch clauses, which would shadow them in the JVM exception table; and third, raw parser tokens (such as LCurly, RCurly, Throw, Try, Catch, and Finally) are incorrectly assumed to have a .location property or are used directly as Location objects, and should instead have their location properties explicitly mapped.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This reverts commit 8e933b6.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Implement exception handling for the following components (in progress):