Feature/DeadCodeEliminationExceptionsFix
Jonathan Brachthäuser
Branch: bstudios/opal:feature/DeadCodeEliminationExceptionsFix
Branch: delors/opal:develop
Declined
Declined pull request
Thank you very much for the PR; it provided me with a good starting point. I declined it because it didn't handle all cases related to nested/overlapping try/catchs which – overall – required a more thorough solution. The commit #44080ec7f76e27f5c1e9706ce9b14f0b8f422e41 should provide the required solution.
Closed by: Michael Eichberg·2018-03-26
Generating code with
CODE
containing exception handlers such asTRY(Symbol('FOO)) NOP TRYEND(Symbol('FOO)) CATCH(Symbol('FOO), Some(ObjectType.Throwable)) ATHROW
leads to
Caused by: java.lang.IllegalArgumentException: 'try end 'FOO without try [error] at org.opalj.ba.CODE$.$anonfun$removeDeadCode$4(CODE.scala:287) [error] at org.opalj.ba.CODE$.removeDeadCode(CODE.scala:236) [error] at org.opalj.ba.CODE$.apply(CODE.scala:349)
if the try is identified as dead code.
This PR avoids this problem by restricting the extent of alive-marking from pseudocode to "pseudocode without exception instructions".