Switch

david32768@btinternet.com david32768@btinternet.com david32768 at btinternet.com
Sat Jan 27 17:11:59 UTC 2024


Hi.

# ClassPrinter

ClassPrinter prints lookupswitch like tableswitch thus losing 
information (the values switched on) whereas the reverse would not.

#  Duplicate and ambiguous switch cases.

Lookupswitch throws an exception but where depends on the ClassFile 
options specified but tableswitch silently ignores it by dropping a 
switch case.

# SequencedSet

ClassFile improves on ASM by using a List<SwitchCase> parameter rather 
than two arrays but would not a SequencedSet<SwitchCase> be better as 
the switch cases would be prechecked.

# Switch

Normally the user would just prefer the shortest code switch, so could 
there be a switch(Label default, SequencedSet<SwitchCase> cases) method.

# Dead Code

I was surprised that the default was to change deadcode to nop, throw. 
Also there is no dead code option to faill with an exception.

Cheers
David.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20240127/aa7803d7/attachment.htm>


More information about the classfile-api-dev mailing list