RFR: JDK-8264222: Use switch expression in jshell where possible

Brian Goetz briangoetz at openjdk.java.net
Fri Mar 26 22:10:24 UTC 2021


On Fri, 26 Mar 2021 00:43:44 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:

> This change is powered by IntelliJ IDEA quick-fix.
> I also took the liberty to fix C-style arrays in changed files.
> 
> In SourceCodeAnalysisImpl.java:501, I left case PARAMETERIZED_TYPE -> FALSE as a separate switch case, because it had a comment. Better formatting ideas are welcome.
> 
> If you like this, I can provide similar PR in other components as well (e.g. in javac)

Cute trick for the partial update to `c`.  
The comment in the last hunk (resultTypeOf()) only applied to the INSTANCE and STATIC init cases, but now it applies to CONSTRUCTOR too (in a previous hunk, you deliberately had a redundant case, to preserve this information.)   I would update the comment.

Otherwise, all looks good to me, +1.

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

Marked as reviewed by briangoetz (Reviewer).

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


More information about the kulla-dev mailing list