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