[
https://jira.codehaus.org/browse/MCOMPILER-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=353829#comment-353829
]
Robert Scholte edited comment on MCOMPILER-228 at 10/6/14 2:25 PM:
-------------------------------------------------------------------
To be precise: it was not a maven-compiler-plugin issue, but an Oracle JDK bug.
IT has been added in [r1629739|http://svn.apache.org/r1629739]
JDK1.8.0_40 also contains the fix.
was (Author: rfscholte):
To be precise: it was not a maven-compiler-plugin issue, but an Oracle JDK bug.
IT has been added in [r1629739|http://svn.apache.org/r1629739]
> cannot assign a value to final variable in lamda
> ------------------------------------------------
>
> Key: MCOMPILER-228
> URL: https://jira.codehaus.org/browse/MCOMPILER-228
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.1
> Environment: Windows 7 64 bit, Maven 3.2.2, JDK 64 bit 8u5
> Reporter: Robert Kish
> Assignee: Robert Scholte
> Priority: Minor
> Attachments: FinalExample.java, MCOMPILER-228.patch
>
>
> Code example compiles in Eclipse, but not with Maven Compiler Plugin. Code is
> like below (inside a lamda expression)
> {code}
> final x;
> if (some condition)
> x = a;
> else if (some other condition)
> x = b;
> else
> x = c;
> {code}
> See attached example source.
> {noformat}
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
> on project MediaIndexer: Compilation failure: Compilation failure:
> [ERROR] /C:/MAPS/MediaIndexer/src/main/java/example/FinalExample.java:[11,13]
> cannot assign a value to final variable compareTo
> [ERROR] /C:/MAPS/MediaIndexer/src/main/java/example/FinalExample.java:[14,13]
> cannot assign a value to final variable compareTo
> [ERROR] /C:/MAPS/MediaIndexer/src/main/java/example/FinalExample.java:[17,13]
> cannot assign a value to final variable compareTo
> {noformat}
> The workaround is to remove final for the variable and just ensure that the
> value is assigned in each code path.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)