简体   繁体   English

Intellij不会报告从内部类内部访问了局部变量,需要将其声明为final

[英]Intellij doesn't report that a local variable is accessed from within inner class and needs to be declared final

I'm using intellij on OSX to write android apps. 我在OSX上使用intellij编写Android应用程序。 I've noticed that my intellij stopped reporting that a local variable is accessed from within inner class and needs to be declared final. 我注意到,我的intellij不再报告从内部类内部访问局部变量,并且需要将其声明为final。 This means that I don't see the red marker and only when I compile the app I get the error message from gradle. 这意味着我看不到红色标记,只有在编译应用程序时,我才从gradle那里收到错误消息。

Picture from intellij 图片来自intellij

在此处输入图片说明

userId should have red marker, like this userId应该带有红色标记,像这样

在此处输入图片说明

Error message: 错误信息:

在此处输入图片说明

Any idea how to fix it? 知道如何解决吗?

Have you changed "Language level" in Intellij or somewhere in Gradle files? 您是否已在Intellij或Gradle文件中的某处更改了“语言级别”? Intellij probably thinks that files are for Java8, where "effective final", without keyword, is good enough. Intellij可能认为文件是针对Java8的,其中没有关键字的“有效的final”就足够了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “从内部类访问变量需要声明为final”错误 - "variable is accessed from within inner class needs to be declared final" error 从内部类访问变量“ ”,需要声明为 final - Variable ' ' is accessed from within inner class, needs to be declared final 从内部 class 访问的变量需要声明为 final - Variable accessed from within inner class needs to be declared final 变量(dialogView)是从内部类中访问的,需要声明为final - Variable (dialogView) is accessed from within inner class, needs to be declared final 从内部类访问变量“i”,需要声明为 final - Variable 'i' is accessed from within inner class, needs to be declared final 变量'btnsave'是从内部类中访问的,需要声明为final - Variable 'btnsave' is accessed from within inner class, needs to be declared final 从内部类内部访问局部变量user_input; 需要宣布为最终 - local variable user_input is accessed from within inner class; needs to be declared final 错误:从内部类访问局部变量 imagesLabel; 需要声明为 final (Java) - Error: local variable imagesLabel is accessed from within inner class; needs to be declared final (Java) 错误:从内部类中访问局部变量事件; 需要宣布最终 - Error: local variable event is accessed from within inner class; needs to be declared final 错误:从内部类访问局部变量 a; 需要宣布为最终 - Error: local variable a is accessed from within inner class; needs to be declared final
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM