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
This commit is contained in:
Andy Wilkinson
2024-07-24 18:51:58 +01:00
parent 7161f92e33
commit f9f530ddaa

View File

@@ -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")