From 4c64a2731e0f1bcbe1d7c7c28ae2132f38557e09 Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Thu, 13 Jun 2024 11:45:27 +0200 Subject: [PATCH] Made build K2 ready and remove Gradle warnings (#1564) Made build K2 ready --- buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts | 2 +- .../de/fraunhofer/aisec/cpg/analysis/NullPointerCheck.kt | 2 -- cpg-core/build.gradle.kts | 6 ------ .../aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt | 2 +- cpg-language-java/build.gradle.kts | 6 ------ 5 files changed, 2 insertions(+), 16 deletions(-) diff --git a/buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts b/buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts index 8a5b26d9ab..b97476bb4c 100644 --- a/buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts @@ -105,7 +105,7 @@ kotlin { } tasks.withType { - kotlinOptions { + compilerOptions { freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn", "-Xcontext-receivers") } } diff --git a/cpg-console/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/NullPointerCheck.kt b/cpg-console/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/NullPointerCheck.kt index 6a7d98bc9a..c103898d0f 100644 --- a/cpg-console/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/NullPointerCheck.kt +++ b/cpg-console/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/NullPointerCheck.kt @@ -23,8 +23,6 @@ * \______/ \__| \______/ * */ -@file:Suppress("JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE") - package de.fraunhofer.aisec.cpg.analysis import de.fraunhofer.aisec.cpg.TranslationResult diff --git a/cpg-core/build.gradle.kts b/cpg-core/build.gradle.kts index be5d9c6b7e..d21606d204 100644 --- a/cpg-core/build.gradle.kts +++ b/cpg-core/build.gradle.kts @@ -43,12 +43,6 @@ publishing { } } -tasks.withType().configureEach { - kotlinOptions { - freeCompilerArgs = listOf("-Xcontext-receivers") - } -} - tasks.test { useJUnitPlatform { if (!project.hasProperty("experimental")) { diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt index ddc93cfa72..fc3f79082c 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt @@ -322,7 +322,7 @@ open class ControlFlowSensitiveDFGPass(ctx: TranslationContext) : EOGStarterPass val lhs = currentNode.lhs.singleOrNull() writtenDeclaration = (lhs as? Reference)?.refersTo - if (writtenDeclaration != null && lhs != null) { + if (writtenDeclaration != null) { val prev = doubleState.declarationsState[writtenDeclaration] findAndSetProperties(prev?.elements ?: setOf(), currentNode) // Data flows from the last writes to the lhs variable to this node diff --git a/cpg-language-java/build.gradle.kts b/cpg-language-java/build.gradle.kts index cc70119e67..d8a0986a68 100644 --- a/cpg-language-java/build.gradle.kts +++ b/cpg-language-java/build.gradle.kts @@ -39,12 +39,6 @@ publishing { } } -tasks.withType().configureEach { - kotlinOptions { - freeCompilerArgs = listOf("-Xcontext-receivers") - } -} - dependencies { api(libs.javaparser) }