Type annotation on record component doesn't seem to be supported by javac ?
Vicente Romero
vicente.romero at oracle.com
Wed Oct 9 04:07:47 UTC 2019
Hi Remi,
Getting that error messages looks weird, what's the full test case?
Thanks,
Vicente
On 10/8/19 6:26 PM, Remi Forax wrote:
> Answering to myself,
> I use TYPE_PARAMETER instead of TYPE_USE when declaring the annotation (facepalm)
>
> but anyway, with TYPE_USE
> @Target(ElementType.TYPE_USE)
> @Retention(RetentionPolicy.RUNTIME)
> public @interface TypeAnn { }
>
> I get:
> /src/main/java/fr.umlv.record/jdk14/AllStructures.java:9: error: scoping construct cannot be annotated with type-use annotation: @jdk14.TypeAnn
> record RecordSubType(@Ann int component1, @TypeAnn String component2) {
>
> I have no idea what a scoping construct is ?
>
> Rémi
>
> ----- Mail original -----
>> De: "Remi Forax" <forax at univ-mlv.fr>
>> À: "amber-dev" <amber-dev at openjdk.java.net>
>> Envoyé: Mardi 8 Octobre 2019 23:54:00
>> Objet: Type annotation on record component doesn't seem to be supported by javac ?
>> Hi all,
>> with a type annnotation on a record component defined like this
>>
>> @Target(ElementType.TYPE_PARAMETER)
>> @Retention(RetentionPolicy.RUNTIME)
>> public @interface TypeAnn { }
>>
>> I get:
>> ./src/main/java/fr.umlv.record/jdk14/AllStructures.java:11: error: annotation
>> type not applicable to this kind of declaration
>> record RecordSubType(@Ann int component1, @TypeAnn String component2) {
>>
>> Note: i'm using jdk 14-amber+0-df2722d9f9d0, i will test with the current source
>> asap.
>>
>> regards,
>> Rémi
More information about the amber-dev
mailing list