From 4a28fcc6aa3148223fae6f904a220729c2a29e6a Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Mon, 4 Sep 2023 14:46:47 -0400 Subject: [PATCH] Suppress warnings about safe `this` leaks Leaking `this` before the constructor has completed can be dangerous in general, specifically if any methods are called or not-yet-initialized fields are used. However, in the specific cases addressed here, the escaping `this` is merely recorded in fields of other objects for later use. Members of `this` instance are not actually used during construction, so these escapes are safe. --- .../src/main/kotlin/com/ibm/wala/gradle/VerifiedDownload.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build-logic/src/main/kotlin/com/ibm/wala/gradle/VerifiedDownload.kt b/build-logic/src/main/kotlin/com/ibm/wala/gradle/VerifiedDownload.kt index 869f593c54..af1efb2919 100644 --- a/build-logic/src/main/kotlin/com/ibm/wala/gradle/VerifiedDownload.kt +++ b/build-logic/src/main/kotlin/com/ibm/wala/gradle/VerifiedDownload.kt @@ -38,11 +38,13 @@ abstract class VerifiedDownload : DefaultTask() { // plugin-provided extension for downloading a resource from some URL @Internal + @Suppress("LeakingThis") val downloadExtension: DownloadExtension = project.objects.newInstance(DownloadExtension::class.java, this) // plugin-provided extension for verifying that a file has the expected checksum @Internal + @Suppress("LeakingThis") val verifyExtension: VerifyExtension = project.objects.newInstance(VerifyExtension::class.java, this)