RFR (s) 8114842: JShell: SourceCodeAnalysis splits code with array initialiazer incorrectly

Jan Lahoda jan.lahoda at oracle.com
Mon Nov 21 19:37:19 UTC 2016


Seems OK.

Jan

On 19.11.2016 00:09, Robert Field wrote:
> New version, fixes trailing comma problem.  Fixes original problem (by
> code deletion!).
>
> Many new test cases.
>
> Webrev:
>
>      http://cr.openjdk.java.net/~rfield/8114842v1.webrev/
>
> Thanks,
> Robert
>
>
> On 11/18/16 10:37, Jan Lahoda wrote:
>> On 18.11.2016 18:57, Robert Field wrote:
>>> Strange, I don't get any of the behaviors you show (what did you see
>>> this on?) --
>>
>> Oops, sorry, that was with some other changes already (which were
>> motivated by the failing "int m = 0,").
>>
>>>
>>> jshell> int m = 0,
>>> |  Error:
>>> |  <identifier> expected
>>> |  int m = 0,;
>>> |            ^
>>>
>>> jshell> int n1 = 0, n2
>>> n1 ==> 0
>>> n2 ==> 0
>>>
>>> jshell> int n1 = 0, n2 =
>>>     ...> 5
>>> n1 ==> 0
>>> n2 ==> 5
>>>
>>> The first one though is definitely a problem.  That is because XTERM is
>>> set for COMMA, I'm trying to figure out why that is set. Comma can
>>
>> I thought it is more due to COMMA being XEXPR, so parseExpression()
>> goes through ',', and claims the input is complete (with semi)?
>>
>> Jan
>>
>>> terminate a list of values, but that would be in braces and never seen
>>> here.
>>>
>>> -Robert
>>>
>>>
>>> On 11/18/16 08:09, Jan Lahoda wrote:
>>>> Seems to me the handling of commas in declarations is not quite
>>>> correct. Consider for example:
>>>> ---
>>>> jshell> int m = 0,
>>>> |  Error:
>>>> |  reached end of file while parsing
>>>> |  int m = 0,
>>>> |            ^
>>>>
>>>> jshell> int n1 = 0, n2
>>>> |  Error:
>>>> |  reached end of file while parsing
>>>> |  int n1 = 0, n2
>>>> |                ^
>>>>
>>>> jshell> int n1 = 0, n2 =
>>>> |  Error:
>>>> |  reached end of file while parsing
>>>> |  int n1 = 0, n2 =
>>>> |                  ^
>>>> ---
>>>>
>>>> Would something along these lines work better?
>>>> http://cr.openjdk.java.net/~jlahoda/8114842/comma-in-decls.diff
>>>>
>>>> Jan
>>>>
>>>>
>>>> On 16.11.2016 23:35, Robert Field wrote:
>>>>> Bug:
>>>>>
>>>>>      https://bugs.openjdk.java.net/browse/JDK-8114842
>>>>>
>>>>> Webrev:
>>>>>
>>>>>      http://cr.openjdk.java.net/~rfield/8114842v0.webrev/
>>>>>
>>>>> Thanks,
>>>>> Robert
>>>>>
>>>
>


More information about the kulla-dev mailing list