RFR: JEP 359-Records: compiler code

Vicente Romero vicente.romero at oracle.com
Wed Oct 30 19:03:50 UTC 2019


OK will do that,
Vicente

On 10/30/19 2:54 PM, Maurizio Cimadamore wrote:
> I agree with Srikanth here - while I understand that after pars8ing, 
> components are just fields, they are still fields with special status 
> (e.g. flag), and TypeEnter knows about them, so it should be possible 
> to issue the 'right' error message there.
>
> Maurizio
>
> On 30/10/2019 18:07, Vicente Romero wrote:
>>>
>>> (11) Likewise I was surprised to see 
>>> Errors.RecordCantDeclareDuplicateFields being emitted
>>> in com.sun.tools.javac.parser.JavacParser#recordDeclaration.
>>> I would have expected this to be emitted in 
>>> com.sun.tools.javac.comp.Check#checkUnique
>>
>> right, there are two opposed forces here. The check is in JavacParser 
>> because record components exists until JavacParser. From that point 
>> on, they are not record components anymore but fields and parameters 
>> to a constructor. So if they are repeated then we would be talking to 
>> the user about fields and method parameters that he didn't declare he 
>> just declared record components. That's why the code is there. I can 
>> move it but then the user will probably have spurious error messages.



More information about the compiler-dev mailing list