Flexible constructors and switch pattern incompatibility

Archie Cobbs archie.cobbs at gmail.com
Sat May 11 16:01:20 UTC 2024


There is an issue with flexible constructors and certain
synthetically-generated try/catch code, for example, when using switch
patterns (where a try/catch for MatchException is sprinkled in).

Please see https://bugs.openjdk.org/browse/JDK-8332106 for an example.

As I understand it, this is due to the same verifier 'uninitializedThis'
restriction that prevents bytecode rewriters from building a synthetic
try/catch around super() calls, even if the catch clause always rethrows.

I may have this muddled, but I believe this restriction disallows an
'uninitializedThis' in a catch clause stack map even if the
'uninitializedThis' is never actually touched. In which case a seemingly
obvious fix for this is to relax the restriction, but that's a JVMS change.

Are there other options?

Thanks,
-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240511/363d4910/attachment.htm>


More information about the amber-dev mailing list