RFR: 8210742: Compound var declaration splitting seems broken (original) (raw)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Nov 15 11:43:40 UTC 2018


Hi, I think what you are doing is ok, but I have some comments:

  1. it seems like this code:

startPos = TreeInfo.getStartPos(mods); if (startPos == Position.NOPOS)    startPos = TreeInfo.getStartPos(type);

should probably be lifted outside the 'if' - e.g. should apply to all cases after the check for "isRestrictedLocalVarTypeName"

  1. A similar argument applies, kind of, to setting type to 'null'. With your patch we do that in 2/3 branches; the branch that is left out is when you have a var declaration like this:

var foo[] = ...

In this case the parser will still attempt to create a var tree with 'var' as its type. If we are worried about how the AST would look in erroneous cases, then I think this is a problem too.

Cheers Maurizio

On 15/11/2018 10:31, srinivas wrote:

Hi,

Please review http://cr.openjdk.java.net/~sdama/8210742/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8210742. Regards, Srinivas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20181115/5c08d8d8/attachment.html>



More information about the compiler-dev mailing list