Lombok @RequiredArgsConstructor(onConstructor_ = {@MyAnnotation}) IntelliJ IDEA 编译错误
Lombok @RequiredArgsConstructor(onConstructor_ = {@MyAnnotation}) compilation error with IntelliJ IDEA
我在 mac 上进行了以下设置:
IntelliJ IDEA Ultimate: 2018.1
Lombok Plugin Version: 0.18-2018.1
Java: 1.8.0_111
此外,我已经按照建议启用了注释处理器 here
但我仍然有以下编译错误:
Cannot resolve method 'onConstructor_'
请指出缺少哪些配置。
您应该像这样使用 onConstructor
参数:
onConstructor=@__({@AnnotationsHere})
见龙目岛documentation:
To put annotations on the generated constructor, you can use onConstructor=@__({@AnnotationsHere})
请确保您在IntelliJ IDEA中开启了注解处理并添加了lombok插件。这应该可以解决大多数情况下的问题。
文档中提到了下面。
* up to JDK7:<br>
* {@code @RequiredArgsConstructor(onConstructor=@__({@AnnotationsGoHere}))}<br>
* from JDK8:<br>
* {@code @RequiredArgsConstructor(onConstructor_={@AnnotationsGohere})} // note the underscore after {@code onConstructor}.
我在 mac 上进行了以下设置:
IntelliJ IDEA Ultimate: 2018.1
Lombok Plugin Version: 0.18-2018.1
Java: 1.8.0_111
此外,我已经按照建议启用了注释处理器 here
但我仍然有以下编译错误:
Cannot resolve method 'onConstructor_'
请指出缺少哪些配置。
您应该像这样使用 onConstructor
参数:
onConstructor=@__({@AnnotationsHere})
见龙目岛documentation:
To put annotations on the generated constructor, you can use onConstructor=@__({@AnnotationsHere})
请确保您在IntelliJ IDEA中开启了注解处理并添加了lombok插件。这应该可以解决大多数情况下的问题。 文档中提到了下面。
* up to JDK7:<br>
* {@code @RequiredArgsConstructor(onConstructor=@__({@AnnotationsGoHere}))}<br>
* from JDK8:<br>
* {@code @RequiredArgsConstructor(onConstructor_={@AnnotationsGohere})} // note the underscore after {@code onConstructor}.