RFR: JDK-8247352: improve error messages for sealed classes and records

Vicente Romero vicente.romero at oracle.com
Fri Sep 4 15:13:02 UTC 2020


right we can improve that as a separate effort, but currently this is 
the behavior for tokens not expected by the parser. This is not 
exclusive for records, so could be part of an extended effort.

Thanks,
Vicente

On 9/4/20 8:05 AM, Remi Forax wrote:
> Hi,
> there is another message that could be improved,
> when someone try to use inheritance with a record,
> the error message is pretty obscure.
>
> record Foo() extends Object {
> }
>
>
> the current error message is
>    Error:
>      '{' expected
>      record Foo() extends Object {}
>                  ^
>
> regards,
> Rémi
>
> ----- Mail original -----
>> De: "Vicente Romero" <vicente.romero at oracle.com>
>> À: "compiler-dev" <compiler-dev at openjdk.java.net>
>> Envoyé: Vendredi 4 Septembre 2020 03:31:11
>> Objet: RFR: JDK-8247352: improve error messages for sealed classes and records
>> Hi,
>>
>> Please review the fix for [1] at [2]. The patch is basically changing
>> some error messages for records and sealed classes trying to make them
>> easier to digest by the user. The bug entry at [1] list some code
>> snippets that motivated this fix,
>>
>> Thanks,
>> Vicente
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8247352
>> [2] http://cr.openjdk.java.net/~vromero/8247352/webrev.00/



More information about the compiler-dev mailing list