RFR: 8271356: Modify jdb to treat an empty command as a repeat of the previous command [v3]

Jakob Cornell github.com+5642931+jakobcornell at openjdk.java.net
Fri Sep 3 05:13:29 UTC 2021


On Tue, 31 Aug 2021 18:54:18 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Jakob Cornell has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR.
>
> src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java line 458:
> 
>> 456:                     int repeat = Integer.parseInt(cmd);
>> 457:                     String subcom = t.nextToken("");
>> 458:                     for (int r = 0; r < repeat; r += 1) {
> 
> Not sure why you made this change. The previous version seems more readable.

Oh, I'm much more used to the `for` loop approach as a do-n-times idiom.  I find the autoincrement/autodecrement operators needlessly unintuitive in general, and in this case it destroys the original value of `repeat`.  I can certainly revert this if OpenJDK uses the `while` idiom though.

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

PR: https://git.openjdk.java.net/jdk/pull/5290


More information about the serviceability-dev mailing list