RFR: JDK-8238838: spurious error message for compact constructors with throws clause
Vicente Romero
vicente.romero at oracle.com
Thu Feb 13 13:45:12 UTC 2020
On 2/13/20 6:40 AM, Maurizio Cimadamore wrote:
> Fix looks good. Note that, by using a name instead of a symbol
> (although I agree it has to be that way, at least in the parser) means
> that you will get no name disambiguation support from the rich
> diagnostic formatter. That is - in a case where you have multiple
> records with same name (but in different scopes), the new message will
> show just the record name, while I think using symbols will also add
> package names to disambiguate things. Not that it will be terribly
> important in this particular case.
>
> Another option would be to create a specific parser diagnostic - but I
> don't think we need to go that far.
we could do that in the future if we see it necessary
>
> Maurizio
Thanks for the review,
Vicente
>
> On 13/02/2020 04:43, Vicente Romero wrote:
>> ping
>>
>> On 2/11/20 3:35 PM, Vicente Romero wrote:
>>> Hi,
>>>
>>> Please review the fix for [1] at [2]. The fix is oriented at showing
>>> a friendlier error message in case a throws clause is declared in a
>>> compact constructor. We already issue an error for this case for
>>> canonical constructors so the same support could be expected for
>>> compact ones. I had to modify the arguments for a generic error
>>> message used for compact and canonical constructors as the error for
>>> canonical constructors is shown in Attr while the error for compact
>>> is shown in the parser. This is because the syntax for compact
>>> constructors doesn't expect anything between the constructor's name
>>> and its body. As at parser time there are no symbols in the ASTs I
>>> changed a parameter for the generic error message from `symbol` to
>>> `name`. This change has provoked that other error logging related to
>>> constructors had to be changed.
>>>
>>> Thanks,
>>> Vicente
>>>
>>> [1] https://bugs.openjdk.java.net/browse/JDK-8238838
>>> [2] http://cr.openjdk.java.net/~vromero/8238838/webrev.00/
>>
More information about the compiler-dev
mailing list