I've got this error while trying to use a local member of one class in inner class inside.
I know that declare it as final will solve the issue but I read that Java 8 should handle it automaticlly, I'm using Intellij with Java 8 and it still does not compile.
Is there any other way to fix it without declare it as final?
I know that declare it as final will solve the issue but I read that Java 8 should handle it automatically.
Java 8 will handle it if the variable is effectively final.
I can think of two possible explanations:
Maybe the variable is not effectively final. Try explicitly declaring it as
final. If you get a compilation error (e.g. saying that something is trying to modify the
final) then the variable isn't effectively final.
Maybe you haven't configured Intellij and the project properly for Java 8; e.g.