RFR: 8325373: Improve StackCounter error reporting for bad switch cases

Paul Sandoz psandoz at openjdk.org
Wed Apr 24 22:52:27 UTC 2024


On Tue, 23 Apr 2024 12:59:18 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> ClassFile API `StackMapGenerator` attaches print or hex dump of the method to an error message.
> However there is no such attachment when the stack maps generation is  turned off.
> 
> This patch moves class print/dump to `impl.Util::dumpMethod`, so it is shared by `StackMapGenerator` and `StackCounter` to provide the same level of details in case of an error.
> 
> Please review.
> 
> Thank you,
> Adam

Looks good, just update the copy write date in Util.java.

src/java.base/share/classes/jdk/internal/classfile/impl/Util.java line 229:

> 227:                     }))));
> 228:             ClassPrinter.toYaml(clm.methods().get(0).code().get(), ClassPrinter.Verbosity.TRACE_ALL, dump);
> 229:         } catch (Error | Exception suppresed) {

If you like you can replace `suppresed` [sic] with `_`.

-------------

Marked as reviewed by psandoz (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18914#pullrequestreview-2021078844
PR Review Comment: https://git.openjdk.org/jdk/pull/18914#discussion_r1578604408


More information about the core-libs-dev mailing list