RFR: JDK-8192963/JDK-8206986 JEP 325: Switch Expressions (Preview)

Vicente Romero vicente.romero at oracle.com
Wed Jul 18 17:59:43 UTC 2018

pretty nice work, some notes below:

- SwitchExpressionTree.java is a new file so the copyright should say 
2018 only plus you should remove some @author comments, probably taken 
from SwitchTree.
- Attr, it is a bit weird seeing, the method below receiving a tree 
instead of an expression, consider renaming it to attribTree
         public Type attribExpr(JCTree tree, Env<AttrContext> env, 
ResultInfo resultInfo)
- also in Attr, isn't: @Override public void visitMethodDef(JCMethodDecl 
tree) {} at the TreeScanner anonymous class created at 
visitSwitchExpression redundant?
- at Lower, minor, inside method: convertCase, is it necessary to always 
create a block inside visitBreak?

overall great job!

On 07/17/2018 02:00 PM, Jan Lahoda wrote:
> Hi,
> As JEP 325 is in the proposed to target state, I thought it might be a 
> good idea to start a review process for the code.
> The code here strives to implement the current specification for the 
> Switch Expressions:
> http://cr.openjdk.java.net/~gbierman/switch-expressions.html
> The current webrev is here:
> http://cr.openjdk.java.net/~jlahoda/8192963/webrev.00/
> (includes a list of new errors.)
> JBS:
> https://bugs.openjdk.java.net/browse/JDK-8192963
> https://bugs.openjdk.java.net/browse/JDK-8206986
> CSRs:
> https://bugs.openjdk.java.net/browse/JDK-8207241
> https://bugs.openjdk.java.net/browse/JDK-8207406
> Any feedback is welcome!
> Thanks,
>     Jan

More information about the compiler-dev mailing list