From f9f530ddaae45ad465caab5703854179caa43bb5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 24 Jul 2024 18:51:58 +0100 Subject: [PATCH] Remove method references to improve compatibility The use of method references requires the referenced method to be present even if it isn't called. This made it impossible for Gradle to remove the deprecated methods as it would break our plugin. By switching the lambdas, the methods only have to be present when they're called which will only happen with Gradle 8.2 and earlier. Closes gh-41599 --- .../boot/gradle/tasks/bundling/BootArchiveSupport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java index 330bc1aef1..e90a6335b5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,11 +150,11 @@ class BootArchiveSupport { } private Integer getDirMode(CopySpec copySpec) { - return getMode(copySpec, "getDirPermissions", copySpec::getDirMode); + return getMode(copySpec, "getDirPermissions", () -> copySpec.getDirMode()); } private Integer getFileMode(CopySpec copySpec) { - return getMode(copySpec, "getFilePermissions", copySpec::getFileMode); + return getMode(copySpec, "getFilePermissions", () -> copySpec.getFileMode()); } @SuppressWarnings("unchecked")