java - "variable is accessed from within inner class needs to be declared final" error -
i've got error while trying use local member of 1 class in inner class inside. know declare final solve issue read java 8 should handle automaticlly, i'm using intellij java 8 , still not compile. there other way fix without declare final? thanks.
i know declare final solve issue read java 8 should handle automatically.
java 8 handle if variable effectively final.
i can think of 2 possible explanations:
maybe variable not effectively final. try explicitly declaring
final
. if compilation error (e.g. saying trying modifyfinal
) variable isn't final.maybe haven't configured intellij , project java 8; e.g.
- set source level; see @saman's answer
- check have right jdk selected: java 8 doesn't compile on intellij15
Comments
Post a Comment