JEP proposal: Generic/Interfaced Enums as annotation attributes

Alex Buckley alex.buckley at oracle.com
Tue Feb 15 22:19:03 UTC 2022


On 2/15/2022 2:04 PM, Marc Miranda wrote:
> I am not sure we are talking of the same use case.
> In my case I am fine with non-generic enums, it is just about letting
> annotation attributes pass an enum reference

But an annotation can already have enum-typed elements. Here's an 
example from JLS 9.6.1:

@interface Quality {
     enum Level { BAD, INDIFFERENT, GOOD }
     Level value();
}

@Quality(Quality.Level.BAD) public class Foo {}

Alex


More information about the amber-dev mailing list