RFR: 8314275: Incorrect stepping in switch [v2]
Vicente Romero
vromero at openjdk.org
Thu Feb 8 16:23:55 UTC 2024
On Thu, 8 Feb 2024 14:57:16 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> In code like the one below, the observable effect was that if the user debugs the following method, `multiply` called with `1`, the debugger steps from line 4 to line 6 (instead of 7) giving the impression that line 6 is going to be executed. The reason is that the `LineNumberTable` did not include an entry at the end of the `switch` mapping the statement that follows, to bytecode.
>>
>>
>> 1 private static double multiply(Integer i) {
>> 2 double cr = 15;
>> 3 cr = switch (i) {
>> 4 case 1 -> cr * 1;
>> 5 case 2 -> cr * 2;
>> 6 default -> cr * 4;
>> 7 };
>> 8 return cr;
>> 9 }
>
> Aggelos Biboudis has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'master' into fix-#8314275
> - 8314275: Incorrect stepping in switch
looks good, just a minor comment
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java line 1433:
> 1431:
> 1432: // Emit line position for the end of the switch
> 1433: code.statBegin(TreeInfo.endPos(swtch));
shouldn't this change affect already existing tests like: RuleSwitchBreaks.java in the same folder: test/langtools/tools/javac/classfiles/attributes/LineNumberTable/?
-------------
Marked as reviewed by vromero (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17772#pullrequestreview-1870690309
PR Review Comment: https://git.openjdk.org/jdk/pull/17772#discussion_r1483253681
More information about the compiler-dev
mailing list