forked from eclipse-jdt/eclipse.jdt.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record with exception in constructor results in invalid byte code
The following code results in generating instructions after an athrow byte code statement: record X(String s) { X { throw new RuntimeException(); } } This is due to CompactConstructorDeclaration.checkAndGenerateFieldAssignment() appending field assignments after the record constructor body. This change adjusts CompactConstructorDeclaration to not generate field assignments if the execution flow is unreachable or dead after adding the statements from the record constructor. This prevents generating code after an athrow statement in the byte code. Fixes: eclipse-jdt#487 Signed-off-by: Simeon Andreev <[email protected]>
- Loading branch information
1 parent
b681dfb
commit c9c2eb9
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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