Skip to content

Commit

Permalink
Don't use Groovy's withDefault (#37726)
Browse files Browse the repository at this point in the history
Closes #37061
  • Loading branch information
alpar-t authored Jan 23, 2019
1 parent 6130d15 commit f54a3b5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class BuildPlugin implements Plugin<Project> {
static void requireJavaHome(Task task, int version) {
Project rootProject = task.project.rootProject // use root project for global accounting
if (rootProject.hasProperty('requiredJavaVersions') == false) {
rootProject.rootProject.ext.requiredJavaVersions = [:].withDefault{key -> return []}
rootProject.rootProject.ext.requiredJavaVersions = [:]
rootProject.gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
List<String> messages = []
for (entry in rootProject.requiredJavaVersions) {
Expand All @@ -415,7 +415,7 @@ class BuildPlugin implements Plugin<Project> {
throw new GradleException("JAVA${version}_HOME required to run task:\n${task}")
}
} else {
rootProject.requiredJavaVersions.get(version).add(task)
rootProject.requiredJavaVersions.getOrDefault(version, []).add(task)
}
}

Expand Down

0 comments on commit f54a3b5

Please sign in to comment.