【发布时间】:2021-07-14 00:59:50
【问题描述】:
有没有办法获得像 ConstructorProperties 这样具有 @Target(CONSTRUCTOR) 的注解来注解生成的 java 16 记录的构造函数?例如:
@ConstructorProperties({"id", "filename"})
public record Person(long id, String filename) {}
这个 ^ 会导致以下错误:
java: annotation type not applicable to this kind of declaration
【问题讨论】:
标签: java constructor annotations java-record java-16