RFR: JDK15-8242529: javac defines type annotations incorrectly for record members (constructor and property accessor)
Vicente Romero
vicente.romero at oracle.com
Thu Jul 9 18:27:05 UTC 2020
thanks for the review, I updated the review at [1] including yours and
Paul's suggestion,
Vicente
[1] http://cr.openjdk.java.net/~vromero/8242529/webrev.01/
On 7/9/20 12:25 PM, Jan Lahoda wrote:
> Looks good to me. A minor nit might be to move the JCVariableDecl
> recordField into the then section of the subsequent if (so that it is
> not computed unless necessary).
>
> Jan
>
> On 09. 07. 20 4:31, Vicente Romero wrote:
>> Hi,
>>
>> Please review fix for [1] at [2]. Current record implementation is
>> not forward nested type annotations to generated members like in:
>>
>> record R(@RegularAnnotation @TypeAnnotation Callable<@TypeAnnotation
>> ?> foo) {}
>>
>> This patch is fixing one issue that show up in two different
>> generated record members:
>> - the accessor corresponding to the record component
>> - the corresponding parameter in the canonical constructor
>>
>> The issue is that the current implementation is not able to correctly
>> generate the annotated types for these components when such an
>> annotated type has "inner" type annotations like it is the case of
>> `foo` in the example which has `TypeAnnotation` applied to the
>> wildcard. In the case of the corresponding parameter in the canonical
>> constructor the annotated type was generated correctly but the class
>> file reflected the internal type annotation as applied to a field not
>> to a method parameter. In the case of the accessor the inner
>> annotation was not there at all. The patch is making a copy of the
>> expression defining the type of the record component and placing it
>> that the right place for both generated members.
>>
>> Thanks,
>> Vicente
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8242529
>> [2] http://cr.openjdk.java.net/~vromero/8242529/webrev.00/
More information about the compiler-dev
mailing list