[GRADLE-3319] PlatformScalaCompile fails when building classes using Java 8 features Created: 13/Jul/15  Updated: 20/Jul/15  Resolved: 20/Jul/15

Status: Resolved
Project: Gradle
Affects Version/s: 2.5
Fix Version/s: 2.6-rc-1

Type: Bug
Reporter: Gary Hale Assignee: Gary Hale
Resolution: Fixed Votes: 0


 Description   

Forum topic: https://discuss.gradle.org/t/play-plugin-cant-handle-java-8-source-files/10556

Using Java 8 features in a play project causes the following error:

$ gradle runPlayBinary
:createPlayBinaryAssetsJar
:routesCompileRoutesSourcesPlayBinary
:twirlCompileTwirlTemplatesPlayBinary
:scalaCompilePlayBinary FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':scalaCompilePlayBinary'.
    > Unknown constant: 18
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
To reproduce, clone the repo at https://github.com/khernyo/gradle-play-java8-bug (I'm not allowed to upload a file here...) and run:

gradle runPlayBinary
Please note that there is no such problem in an ordinary java/scala mixed project, so I'm guessing that an old sbt is used for compiling play projects.



 Comments   
Comment by Gary Hale [ 13/Jul/15 ]

Looks to be related to the version of sbt libraries pulled in by the Zinc compiler (v0.3.0). Upgrading Zinc to the latest (0.3.7) seems to fix the issue.

Comment by Szabolcs Berecz [ 13/Jul/15 ]

Is it possible to change the Zinc compiler version without a new Gradle release, or is it hard-coded?
I tried to add Zinc 0.3.7 to the buildscript classpath, but no luck, so I guess the answer is no.

Comment by Gary Hale [ 13/Jul/15 ]

Unfortunately, there isn't any way at the moment (which is unfortunate). The version has been updated and should be in the next nightly build.

Generated at Wed Jun 30 12:45:40 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.