Skip to content

Instantly share code, notes, and snippets.

@eccyan
Last active August 29, 2015 14:10
Show Gist options
  • Save eccyan/52377e8fd57fd34840f0 to your computer and use it in GitHub Desktop.
Save eccyan/52377e8fd57fd34840f0 to your computer and use it in GitHub Desktop.
λ... < ユニットテストのテストコード上で Retrolambda が使えない ref: http://qiita.com/eccyan/items/400a60da44d1d603380b
tasks.withType(Test) {
project.tasks
.findAll { task -> (task.name ==~ /compileTest.*Java/) }
.each { task ->
task.doFirst {
def buildPath = "$project.buildDir/retrolambda"
def jarPath = "$buildPath/$project.android.compileSdkVersion"
def javac = "${project.retrolambda.tryGetJdk()}/bin/javac"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.fork = true
options.compilerArgs += ["-bootclasspath", "$jarPath/android.jar"]
options.forkOptions.executable = javac
}
}
}
Test.java:61: error: illegal start of expression
.filter(state -> state != State.UNINITIALIZED)
An exception has occurred in the compiler (1.8.0_25). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.invoke.MethodType not found
23:14:30.815 [DEBUG] [org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler] Compiler arguments: -d /app/build/test-classes/debug -g -encoding UTF-8 -bootclasspath /Applications/android-sdk/platforms/android-21/android.jar -classpath
...
Test > initializationError FAILED
java.lang.UnsupportedClassVersionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment