From 875a2707c90764049eedb21985897af4e77c5c6b Mon Sep 17 00:00:00 2001 From: Goooler Date: Thu, 12 Dec 2024 12:07:20 +0800 Subject: [PATCH] Cleanup --- .../gradle/plugins/shadow/internal/GradleCompat.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/GradleCompat.kt b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/GradleCompat.kt index 77e239a48..399071072 100644 --- a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/GradleCompat.kt +++ b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/GradleCompat.kt @@ -24,17 +24,18 @@ internal inline val Project.runtimeConfiguration: Configuration internal inline fun > ObjectFactory.property( defaultValue: Any? = null, ): P { + val valueClass = V::class.java return when (P::class.java) { - ListProperty::class.java -> listProperty(V::class.java).apply { + ListProperty::class.java -> listProperty(valueClass).apply { if (defaultValue != null) convention(defaultValue as List) } - SetProperty::class.java -> setProperty(V::class.java).apply { + SetProperty::class.java -> setProperty(valueClass).apply { if (defaultValue != null) convention(defaultValue as Set) } - MapProperty::class.java -> mapProperty(String::class.java, V::class.java).apply { + MapProperty::class.java -> mapProperty(String::class.java, valueClass).apply { if (defaultValue != null) convention(defaultValue as Map) } - else -> property(V::class.java).apply { + else -> property(valueClass).apply { if (defaultValue != null) convention(defaultValue as V) } } as P