简体   繁体   English

Lombok IntelliJ IDEA插件:默认情况下,禁用var的使用

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM