[英]how to suppress this warning on the `var` keyword?
The message is:消息是:
Warning:(ROW, COLUMN) java: as of release 10, 'var' is a restricted local variable type and cannot be used for type declarations or as the element type of an array
警告:(ROW,COLUMN)java:从版本 10 开始,'var' 是受限制的局部变量类型,不能用于类型声明或作为数组的元素类型
Am using Lombok 1.18.12
from Java 11 targeting version 7, that's how come those var
are in there.我正在使用来自 Java 11 的 Lombok
1.18.12
,针对版本 7,这就是那些var
在那里的原因。
How to suppress?怎么压制? What to throw in
@SuppressWarnings(...)
?在
@SuppressWarnings(...)
中抛出什么?
[...]
var excepted = false;
[...]
Just don't use lombok's var, and use the one built into java.只是不要使用 lombok 的 var,而使用 java 中内置的那个。 That, or, downgrade to java8.
那,或者,降级到java8。
Lombok's var does effectively the same thing as java10+'s 'var', except lombok allows compound assignments and does not allow non-denotable types (java10 var allows non-denotables, but doesn't allow compound). Lombok 的 var 与 java10+ 的 'var' 做同样的事情,除了 lombok 允许复合赋值并且不允许不可表示类型(java10 var 允许不可表示,但不允许复合)。 These are two exotic concepts you're unlikely to need:)
这是您不太可能需要的两个奇异概念:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.