RFR: 8314275: Incorrect stepping in switch [v3]

Aggelos Biboudis abimpoudis at openjdk.org
Thu Feb 8 17:03:20 UTC 2024


> 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 incrementally with one additional commit since the last revision:

  Ensure fix is effective for switch expressions only

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17772/files
  - new: https://git.openjdk.org/jdk/pull/17772/files/682802c5..a836d976

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17772&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17772&range=01-02

  Stats: 33 lines in 2 files changed: 17 ins; 0 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/17772.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17772/head:pull/17772

PR: https://git.openjdk.org/jdk/pull/17772


More information about the compiler-dev mailing list