[英]Lombok IntelliJ IDEA Plugin: Use of var is disabled by default
I'm using the Lombok Plugin
for IntelliJ IDEA
. 我正在为
IntelliJ IDEA
使用Lombok Plugin
。 When try to run Java
code using the var
keyword, I get the following error: 当尝试使用
var
关键字运行Java
代码时,出现以下错误:
Use of var is disabled by default. Please add 'lombok.var.flagUsage = ALLOW' to 'lombok.config' if you want to enable is.
How do you do that in IntelliJ IDEA
? 您如何在
IntelliJ IDEA
做到这一点? I created the lombok.config
in the project root and pasted lombok.var.flagUsage = ALLOW
but it didn't fix it. 我在项目根目录中创建了
lombok.config
并粘贴了lombok.var.flagUsage = ALLOW
但它没有解决问题。 val
is working but not var
. val
正在工作,但var
无法工作。 I can't seem to find clear instructions on enabling var
. 我似乎找不到启用
var
明确说明。
My Lombok
maven dependency is: 我的
Lombok
Maven依赖项是:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
You may need to recompile everything in order to observe the effect. 您可能需要重新编译所有内容以观察效果。
Actually, any change of any lombok.config
anywhere should trigger a recompilation of all classes in the subtree. 实际上,任何地方对
lombok.config
任何更改都应触发子树中所有类的重新编译。 This is not the case as such changes are rare and don't warrant the probably non-trivial amount of work. 情况并非如此,因为此类更改很少见,并且不保证可能会有不平凡的工作量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.