@@ -50,7 +50,7 @@ static Optional<Duration> durationSysPropertyOrEnvVariable(String sysPropertyNam
50
50
51
51
static Optional <String > envVariable (String name , ProviderFactory providers ) {
52
52
if (isGradle65OrNewer () && !isGradle74OrNewer ()) {
53
- Provider <String > variable = reflectionForUseAtConfigurationTime (providers .environmentVariable (name ));
53
+ Provider <String > variable = forUseAtConfigurationTime (providers .environmentVariable (name ));
54
54
return Optional .ofNullable (variable .getOrNull ());
55
55
}
56
56
return Optional .ofNullable (System .getenv (name ));
@@ -66,7 +66,7 @@ static Optional<Duration> durationEnvVariable(String name, ProviderFactory provi
66
66
67
67
static Optional <String > sysProperty (String name , ProviderFactory providers ) {
68
68
if (isGradle65OrNewer () && !isGradle74OrNewer ()) {
69
- Provider <String > property = reflectionForUseAtConfigurationTime (providers .systemProperty (name ));
69
+ Provider <String > property = forUseAtConfigurationTime (providers .systemProperty (name ));
70
70
return Optional .ofNullable (property .getOrNull ());
71
71
}
72
72
return Optional .ofNullable (System .getProperty (name ));
@@ -267,12 +267,12 @@ private static Optional<URI> toUri(String scheme, String host, String path) {
267
267
}
268
268
}
269
269
270
- private static < T > Provider <T > reflectionForUseAtConfigurationTime (Provider <T > provider ) {
270
+ private static Provider <String > forUseAtConfigurationTime (Provider <String > provider ) {
271
271
if (isGradle65OrNewer () && !isGradle74OrNewer ()) {
272
272
try {
273
273
// Use reflection to access the forUseAtConfigurationTime method as it was removed in Gradle 9.
274
274
Method method = Provider .class .getMethod ("forUseAtConfigurationTime" );
275
- return (Provider <T >) method .invoke (provider );
275
+ return (Provider <String >) method .invoke (provider );
276
276
} catch (Exception e ) {
277
277
throw new RuntimeException ("Failed to invoke forUseAtConfigurationTime via reflection" , e );
278
278
}
0 commit comments