Repository: detekt/detekt (kotlin)

Issue:
Remove CompilerResources from API
<!-- Your feature request may already be reported! -->
<!-- Please search in the [issues](https://github.com/detekt/detekt/issues) before creating a new one. -->

## Expected Behavior
`CompilerResources` is removed from the API, replaced with direct usage of `LanguageVersionSettings`.

## Current Behavior
`CompilerResources` becomes an unnecessary wrapper around `LanguageVersionSettings` once #8177 is merged.

## Context
The unnecessary wrapper can be removed as part of the migration to Kotlin Analysis API.

Pull request:
Fixes: https://github.com/detekt/detekt/issues/8178

Patch:
diff --git a/detekt-api/api/detekt-api.api b/detekt-api/api/detekt-api.api
index 9c4d2f8e46a4..3bef69647f80 100644
--- a/detekt-api/api/detekt-api.api
+++ b/detekt-api/api/detekt-api.api
@@ -11,11 +11,6 @@ public final class io/gitlab/arturbosch/detekt/api/AutocorrectKt {
 	public static final fun setModifiedText (Lorg/jetbrains/kotlin/psi/KtFile;Ljava/lang/String;)V
 }
 
-public final class io/gitlab/arturbosch/detekt/api/CompilerResources {
-	public fun <init> (Lorg/jetbrains/kotlin/config/LanguageVersionSettings;)V
-	public final fun getLanguageVersionSettings ()Lorg/jetbrains/kotlin/config/LanguageVersionSettings;
-}
-
 public abstract interface class io/gitlab/arturbosch/detekt/api/Config {
 	public static final field ACTIVE_KEY Ljava/lang/String;
 	public static final field ALIASES_KEY Ljava/lang/String;
@@ -230,23 +225,23 @@ public abstract interface class io/gitlab/arturbosch/detekt/api/RequiresFullAnal
 }
 
 public class io/gitlab/arturbosch/detekt/api/Rule : io/gitlab/arturbosch/detekt/api/DetektVisitor {
-	protected field compilerResources Lio/gitlab/arturbosch/detekt/api/CompilerResources;
+	protected field languageVersionSettings Lorg/jetbrains/kotlin/config/LanguageVersionSettings;
 	public fun <init> (Lio/gitlab/arturbosch/detekt/api/Config;Ljava/lang/String;Ljava/net/URI;)V
 	public synthetic fun <init> (Lio/gitlab/arturbosch/detekt/api/Config;Ljava/lang/String;Ljava/net/URI;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
 	public final fun getAutoCorrect ()Z
 	public final fun getBindingContext (Lio/gitlab/arturbosch/detekt/api/RequiresFullAnalysis;)Lorg/jetbrains/kotlin/resolve/BindingContext;
-	protected final fun getCompilerResources ()Lio/gitlab/arturbosch/detekt/api/CompilerResources;
 	public final fun getConfig ()Lio/gitlab/arturbosch/detekt/api/Config;
 	public final fun getDescription ()Ljava/lang/String;
+	protected final fun getLanguageVersionSettings ()Lorg/jetbrains/kotlin/config/LanguageVersionSettings;
 	public fun getRuleName ()Lio/gitlab/arturbosch/detekt/api/RuleName;
 	public final fun getUrl ()Ljava/net/URI;
 	protected fun postVisit (Lorg/jetbrains/kotlin/psi/KtFile;)V
 	protected fun preVisit (Lorg/jetbrains/kotlin/psi/KtFile;)V
 	public final fun report (Lio/gitlab/arturbosch/detekt/api/Finding;)V
 	public final fun setBindingContext (Lorg/jetbrains/kotlin/resolve/BindingContext;)V
-	protected final fun setCompilerResources (Lio/gitlab/arturbosch/detekt/api/CompilerResources;)V
+	protected final fun setLanguageVersionSettings (Lorg/jetbrains/kotlin/config/LanguageVersionSettings;)V
 	public fun visit (Lorg/jetbrains/kotlin/psi/KtFile;)V
-	public final fun visitFile (Lorg/jetbrains/kotlin/psi/KtFile;Lio/gitlab/arturbosch/detekt/api/CompilerResources;)Ljava/util/List;
+	public final fun visitFile (Lorg/jetbrains/kotlin/psi/KtFile;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;)Ljava/util/List;
 }
 
 public final class io/gitlab/arturbosch/detekt/api/RuleInstance {
diff --git a/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/CompilerResources.kt b/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/CompilerResources.kt
deleted file mode 100644
index 5630aefe9e75..000000000000
--- a/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/CompilerResources.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package io.gitlab.arturbosch.detekt.api
-
-import org.jetbrains.kotlin.config.LanguageVersionSettings
-
-/**
- * Provides compiler resources.
- */
-class CompilerResources(
-    val languageVersionSettings: LanguageVersionSettings,
-)
diff --git a/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/Rule.kt b/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/Rule.kt
index 49b72f3807de..8ae57c4a7ca0 100644
--- a/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/Rule.kt
+++ b/detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/Rule.kt
@@ -2,6 +2,7 @@ package io.gitlab.arturbosch.detekt.api
 
 import dev.drewhamilton.poko.Poko
 import io.gitlab.arturbosch.detekt.api.internal.validateIdentifier
+import org.jetbrains.kotlin.config.LanguageVersionSettings
 import org.jetbrains.kotlin.psi.KtFile
 import org.jetbrains.kotlin.resolve.BindingContext
 import java.net.URI
@@ -30,7 +31,7 @@ open class Rule(
      */
     open val ruleName: RuleName get() = RuleName(javaClass.simpleName)
 
-    protected lateinit var compilerResources: CompilerResources
+    protected lateinit var languageVersionSettings: LanguageVersionSettings
     private lateinit var _bindingContext: BindingContext
 
     @Suppress("UnusedReceiverParameter")
@@ -53,10 +54,10 @@ open class Rule(
      */
     fun visitFile(
         root: KtFile,
-        compilerResources: CompilerResources,
+        languageVersionSettings: LanguageVersionSettings,
     ): List<Finding> {
         findings.clear()
-        this.compilerResources = compilerResources
+        this.languageVersionSettings = languageVersionSettings
         preVisit(root)
         visit(root)
         postVisit(root)
diff --git a/detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt b/detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt
index 68d136b26da9..28e809eddd00 100644
--- a/detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt
+++ b/detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt
@@ -1,7 +1,6 @@
 package io.gitlab.arturbosch.detekt.core
 
 import io.github.detekt.psi.absolutePath
-import io.gitlab.arturbosch.detekt.api.CompilerResources
 import io.gitlab.arturbosch.detekt.api.Config
 import io.gitlab.arturbosch.detekt.api.Entity
 import io.gitlab.arturbosch.detekt.api.FileProcessListener
@@ -18,6 +17,7 @@ import io.gitlab.arturbosch.detekt.api.internal.whichOS
 import io.gitlab.arturbosch.detekt.core.suppressors.buildSuppressors
 import io.gitlab.arturbosch.detekt.core.suppressors.isSuppressedBy
 import io.gitlab.arturbosch.detekt.core.util.shouldAnalyzeFile
+import org.jetbrains.kotlin.config.LanguageVersionSettings
 import org.jetbrains.kotlin.config.languageVersionSettings
 import org.jetbrains.kotlin.psi.KtFile
 import org.jetbrains.kotlin.resolve.BindingContext
@@ -32,21 +32,20 @@ internal class Analyzer(
     fun run(ktFiles: Collection<KtFile>): List<Issue> {
         val languageVersionSettings = settings.configuration.languageVersionSettings
 
-        val compilerResources = CompilerResources(languageVersionSettings)
         return if (settings.spec.executionSpec.parallelAnalysis) {
-            runAsync(ktFiles, compilerResources)
+            runAsync(ktFiles, languageVersionSettings)
         } else {
-            runSync(ktFiles, compilerResources)
+            runSync(ktFiles, languageVersionSettings)
         }
     }
 
     private fun runSync(
         ktFiles: Collection<KtFile>,
-        compilerResources: CompilerResources,
+        languageVersionSettings: LanguageVersionSettings,
     ): List<Issue> =
         ktFiles.flatMap { file ->
             processors.forEach { it.onProcess(file) }
-            val issues = runCatching { analyze(file, compilerResources) }.fold(
+            val issues = runCatching { analyze(file, languageVersionSettings) }.fold(
                 onSuccess = { it },
                 onFailure = { throwIllegalStateException(file, it) }
             )
@@ -56,13 +55,13 @@ internal class Analyzer(
 
     private fun runAsync(
         ktFiles: Collection<KtFile>,
-        compilerResources: CompilerResources,
+        languageVersionSettings: LanguageVersionSettings,
     ): List<Issue> {
         val service = settings.taskPool
         val tasks: TaskList<List<Issue>?> = ktFiles.map { file ->
             service.task {
                 processors.forEach { it.onProcess(file) }
-                val issues = analyze(file, compilerResources)
+                val issues = analyze(file, languageVersionSettings)
                 processors.forEach { it.onProcessComplete(file, issues) }
                 issues
             }.recover { throwIllegalStateException(file, it) }
@@ -72,7 +71,7 @@ internal class Analyzer(
 
     private fun analyze(
         file: KtFile,
-        compilerResources: CompilerResources,
+        languageVersionSettings: LanguageVersionSettings,
     ): List<Issue> {
         val (correctableRules, otherRules) = rules.asSequence()
             .filter { ruleDescriptor ->
@@ -91,7 +90,7 @@ internal class Analyzer(
             .partition { (_, rule) -> rule.autoCorrect }
 
         return (correctableRules + otherRules).flatMap { (ruleInstance, rule) ->
-            rule.visitFile(file, compilerResources)
+            rule.visitFile(file, languageVersionSettings)
                 .filterNot {
                     it.entity.ktElement.isSuppressedBy(ruleInstance.id, rule.aliases, ruleInstance.ruleSetId)
                 }
diff --git a/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifier.kt b/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifier.kt
index bed369464353..1cded7572d13 100644
--- a/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifier.kt
+++ b/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifier.kt
@@ -58,7 +58,7 @@ class RedundantVisibilityModifier(config: Config) : Rule(
      * See: https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors
      */
     private fun isExplicitApiModeActive(): Boolean {
-        val flag = compilerResources.languageVersionSettings.getFlag(AnalysisFlags.explicitApiMode)
+        val flag = languageVersionSettings.getFlag(AnalysisFlags.explicitApiMode)
         return flag != ExplicitApiMode.DISABLED
     }
 
diff --git a/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnit.kt b/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnit.kt
index 840f47047188..cf69d6c2f26e 100644
--- a/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnit.kt
+++ b/detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnit.kt
@@ -108,7 +108,7 @@ class OptionalUnit(config: Config) :
         }
 
     private fun isExplicitApiModeActive(): Boolean {
-        val flag = compilerResources.languageVersionSettings.getFlag(AnalysisFlags.explicitApiMode)
+        val flag = languageVersionSettings.getFlag(AnalysisFlags.explicitApiMode)
         return flag != ExplicitApiMode.DISABLED
     }
 


Test patch:
diff --git a/detekt-formatting/src/test/kotlin/io/gitlab/arturbosch/detekt/formatting/TestFiles.kt b/detekt-formatting/src/test/kotlin/io/gitlab/arturbosch/detekt/formatting/TestFiles.kt
index 8bbe776e8a6f..3ac9a6aae703 100644
--- a/detekt-formatting/src/test/kotlin/io/gitlab/arturbosch/detekt/formatting/TestFiles.kt
+++ b/detekt-formatting/src/test/kotlin/io/gitlab/arturbosch/detekt/formatting/TestFiles.kt
@@ -5,7 +5,7 @@ import io.github.detekt.test.utils.compileContentForTest
 import io.github.detekt.test.utils.compileForTest
 import io.github.detekt.test.utils.resource
 import io.gitlab.arturbosch.detekt.api.Finding
-import io.gitlab.arturbosch.detekt.test.FakeCompilerResources
+import io.gitlab.arturbosch.detekt.test.FakeLanguageVersionSettings
 import org.intellij.lang.annotations.Language
 import java.io.File
 import kotlin.io.path.toPath
@@ -15,7 +15,7 @@ fun FormattingRule.lint(@Language("kotlin") content: String, fileName: String =
         "filename must be a file name only and not contain any path elements"
     }
     val root = compileContentForTest(content, fileName)
-    return this.visitFile(root, compilerResources = FakeCompilerResources())
+    return this.visitFile(root, languageVersionSettings = FakeLanguageVersionSettings())
 }
 
 fun loadFile(resourceName: String) = compileForTest(resource(resourceName).toPath())
diff --git a/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifierSpec.kt b/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifierSpec.kt
index 2c4d32427f1e..8157d95bef6d 100644
--- a/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifierSpec.kt
+++ b/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/RedundantVisibilityModifierSpec.kt
@@ -1,7 +1,7 @@
 package io.gitlab.arturbosch.detekt.rules.style
 
 import io.gitlab.arturbosch.detekt.api.Config
-import io.gitlab.arturbosch.detekt.test.FakeCompilerResources
+import io.gitlab.arturbosch.detekt.test.FakeLanguageVersionSettings
 import io.gitlab.arturbosch.detekt.test.assertThat
 import io.gitlab.arturbosch.detekt.test.lint
 import org.jetbrains.kotlin.config.ExplicitApiMode
@@ -171,19 +171,19 @@ class RedundantVisibilityModifierSpec {
 
         @Test
         fun `does not report public function in class if explicit API mode is set to strict`() {
-            val findings = subject.lint(code, FakeCompilerResources(ExplicitApiMode.STRICT))
+            val findings = subject.lint(code, FakeLanguageVersionSettings(ExplicitApiMode.STRICT))
             assertThat(findings).isEmpty()
         }
 
         @Test
         fun `does not report public function in class if explicit API mode is set to warning`() {
-            val findings = subject.lint(code, FakeCompilerResources(ExplicitApiMode.WARNING))
+            val findings = subject.lint(code, FakeLanguageVersionSettings(ExplicitApiMode.WARNING))
             assertThat(findings).isEmpty()
         }
 
         @Test
         fun `reports public function in class if explicit API mode is disabled`() {
-            val findings = subject.lint(code, FakeCompilerResources(ExplicitApiMode.DISABLED))
+            val findings = subject.lint(code, FakeLanguageVersionSettings(ExplicitApiMode.DISABLED))
             assertThat(findings).hasSize(1)
         }
     }
diff --git a/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnitSpec.kt b/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnitSpec.kt
index 76b0528e7233..b4857a44dcdd 100644
--- a/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnitSpec.kt
+++ b/detekt-rules-style/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/optional/OptionalUnitSpec.kt
@@ -4,7 +4,7 @@ import io.github.detekt.test.utils.KotlinEnvironmentContainer
 import io.gitlab.arturbosch.detekt.api.Config
 import io.gitlab.arturbosch.detekt.api.Finding
 import io.gitlab.arturbosch.detekt.rules.KotlinCoreEnvironmentTest
-import io.gitlab.arturbosch.detekt.test.FakeCompilerResources
+import io.gitlab.arturbosch.detekt.test.FakeLanguageVersionSettings
 import io.gitlab.arturbosch.detekt.test.lintWithContext
 import org.assertj.core.api.Assertions.assertThat
 import org.jetbrains.kotlin.config.ExplicitApiMode
@@ -410,7 +410,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
             val findings = subject.lintWithContext(
                 env,
                 code,
-                compilerResources = FakeCompilerResources(ExplicitApiMode.STRICT)
+                languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.STRICT)
             )
             assertThat(findings).hasSize(1)
         }
@@ -423,7 +423,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
             val findings = subject.lintWithContext(
                 env,
                 code,
-                compilerResources = FakeCompilerResources(ExplicitApiMode.WARNING)
+                languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.WARNING)
             )
             assertThat(findings).hasSize(1)
         }
@@ -436,7 +436,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
             val findings = subject.lintWithContext(
                 env,
                 code,
-                compilerResources = FakeCompilerResources(ExplicitApiMode.DISABLED)
+                languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.DISABLED)
             )
             assertThat(findings).hasSize(1)
         }
@@ -449,7 +449,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
             val findings = subject.lintWithContext(
                 env,
                 code,
-                compilerResources = FakeCompilerResources(ExplicitApiMode.STRICT)
+                languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.STRICT)
             )
             assertThat(findings).isEmpty()
         }
@@ -462,7 +462,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
             val findings = subject.lintWithContext(
                 env,
                 code,
-                compilerResources = FakeCompilerResources(ExplicitApiMode.WARNING)
+                languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.WARNING)
             )
             assertThat(findings).isEmpty()
         }
@@ -476,7 +476,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
                 subject.lintWithContext(
                     env,
                     code,
-                    compilerResources = FakeCompilerResources(ExplicitApiMode.STRICT)
+                    languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.STRICT)
                 )
             assertThat(findingsWithPrivate).hasSize(1)
 
@@ -487,7 +487,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
                 subject.lintWithContext(
                     env,
                     code2,
-                    compilerResources = FakeCompilerResources(ExplicitApiMode.STRICT)
+                    languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.STRICT)
                 )
             assertThat(findingsWithInternal).hasSize(1)
         }
@@ -501,7 +501,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
                 subject.lintWithContext(
                     env,
                     code,
-                    compilerResources = FakeCompilerResources(ExplicitApiMode.WARNING)
+                    languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.WARNING)
                 )
             assertThat(findingsWithPrivate).hasSize(1)
 
@@ -512,7 +512,7 @@ class OptionalUnitSpec(val env: KotlinEnvironmentContainer) {
                 subject.lintWithContext(
                     env,
                     code2,
-                    compilerResources = FakeCompilerResources(ExplicitApiMode.WARNING)
+                    languageVersionSettings = FakeLanguageVersionSettings(ExplicitApiMode.WARNING)
                 )
             assertThat(findingsWithInternal).hasSize(1)
         }
diff --git a/detekt-test/api/detekt-test.api b/detekt-test/api/detekt-test.api
index f8b5d3a6b5b7..dfe81488ec60 100644
--- a/detekt-test/api/detekt-test.api
+++ b/detekt-test/api/detekt-test.api
@@ -1,6 +1,6 @@
-public final class io/gitlab/arturbosch/detekt/test/FakeCompilerResourcesKt {
-	public static final fun FakeCompilerResources (Lorg/jetbrains/kotlin/config/ExplicitApiMode;)Lio/gitlab/arturbosch/detekt/api/CompilerResources;
-	public static synthetic fun FakeCompilerResources$default (Lorg/jetbrains/kotlin/config/ExplicitApiMode;ILjava/lang/Object;)Lio/gitlab/arturbosch/detekt/api/CompilerResources;
+public final class io/gitlab/arturbosch/detekt/test/FakeLanguageVersionSettingsKt {
+	public static final fun FakeLanguageVersionSettings (Lorg/jetbrains/kotlin/config/ExplicitApiMode;)Lorg/jetbrains/kotlin/config/LanguageVersionSettingsImpl;
+	public static synthetic fun FakeLanguageVersionSettings$default (Lorg/jetbrains/kotlin/config/ExplicitApiMode;ILjava/lang/Object;)Lorg/jetbrains/kotlin/config/LanguageVersionSettingsImpl;
 }
 
 public final class io/gitlab/arturbosch/detekt/test/FindingAssert : org/assertj/core/api/AbstractAssert {
@@ -42,13 +42,13 @@ public final class io/gitlab/arturbosch/detekt/test/ResourcesKt {
 }
 
 public final class io/gitlab/arturbosch/detekt/test/RuleExtensionsKt {
-	public static final fun lint (Lio/gitlab/arturbosch/detekt/api/Rule;Ljava/lang/String;Lio/gitlab/arturbosch/detekt/api/CompilerResources;Z)Ljava/util/List;
-	public static final fun lint (Lio/gitlab/arturbosch/detekt/api/Rule;Lorg/jetbrains/kotlin/psi/KtFile;Lio/gitlab/arturbosch/detekt/api/CompilerResources;)Ljava/util/List;
-	public static synthetic fun lint$default (Lio/gitlab/arturbosch/detekt/api/Rule;Ljava/lang/String;Lio/gitlab/arturbosch/detekt/api/CompilerResources;ZILjava/lang/Object;)Ljava/util/List;
-	public static synthetic fun lint$default (Lio/gitlab/arturbosch/detekt/api/Rule;Lorg/jetbrains/kotlin/psi/KtFile;Lio/gitlab/arturbosch/detekt/api/CompilerResources;ILjava/lang/Object;)Ljava/util/List;
+	public static final fun lint (Lio/gitlab/arturbosch/detekt/api/Rule;Ljava/lang/String;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;Z)Ljava/util/List;
+	public static final fun lint (Lio/gitlab/arturbosch/detekt/api/Rule;Lorg/jetbrains/kotlin/psi/KtFile;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;)Ljava/util/List;
+	public static synthetic fun lint$default (Lio/gitlab/arturbosch/detekt/api/Rule;Ljava/lang/String;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;ZILjava/lang/Object;)Ljava/util/List;
+	public static synthetic fun lint$default (Lio/gitlab/arturbosch/detekt/api/Rule;Lorg/jetbrains/kotlin/psi/KtFile;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;ILjava/lang/Object;)Ljava/util/List;
 	public static final fun lintWithContext (Lio/gitlab/arturbosch/detekt/api/Rule;Lio/github/detekt/test/utils/KotlinEnvironmentContainer;Ljava/lang/String;)Ljava/util/List;
-	public static final fun lintWithContext (Lio/gitlab/arturbosch/detekt/api/Rule;Lio/github/detekt/test/utils/KotlinEnvironmentContainer;Ljava/lang/String;[Ljava/lang/String;Lio/gitlab/arturbosch/detekt/api/CompilerResources;Z)Ljava/util/List;
-	public static synthetic fun lintWithContext$default (Lio/gitlab/arturbosch/detekt/api/Rule;Lio/github/detekt/test/utils/KotlinEnvironmentContainer;Ljava/lang/String;[Ljava/lang/String;Lio/gitlab/arturbosch/detekt/api/CompilerResources;ZILjava/lang/Object;)Ljava/util/List;
+	public static final fun lintWithContext (Lio/gitlab/arturbosch/detekt/api/Rule;Lio/github/detekt/test/utils/KotlinEnvironmentContainer;Ljava/lang/String;[Ljava/lang/String;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;Z)Ljava/util/List;
+	public static synthetic fun lintWithContext$default (Lio/gitlab/arturbosch/detekt/api/Rule;Lio/github/detekt/test/utils/KotlinEnvironmentContainer;Ljava/lang/String;[Ljava/lang/String;Lorg/jetbrains/kotlin/config/LanguageVersionSettings;ZILjava/lang/Object;)Ljava/util/List;
 }
 
 public final class io/gitlab/arturbosch/detekt/test/TestConfig : io/gitlab/arturbosch/detekt/api/Config {
diff --git a/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FakeCompilerResources.kt b/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FakeCompilerResources.kt
deleted file mode 100644
index da92935655b8..000000000000
--- a/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FakeCompilerResources.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.gitlab.arturbosch.detekt.test
-
-import io.gitlab.arturbosch.detekt.api.CompilerResources
-import org.jetbrains.kotlin.config.AnalysisFlags
-import org.jetbrains.kotlin.config.ApiVersion
-import org.jetbrains.kotlin.config.ExplicitApiMode
-import org.jetbrains.kotlin.config.LanguageVersion
-import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
-
-@Suppress("FunctionName")
-fun FakeCompilerResources(
-    mode: ExplicitApiMode = ExplicitApiMode.DISABLED,
-): CompilerResources {
-    val languageVersionSettings = LanguageVersionSettingsImpl(
-        languageVersion = LanguageVersion.LATEST_STABLE,
-        apiVersion = ApiVersion.LATEST_STABLE,
-        analysisFlags = mapOf(AnalysisFlags.explicitApiMode to mode),
-        specificFeatures = emptyMap(),
-    )
-    return CompilerResources(
-        languageVersionSettings
-    )
-}
diff --git a/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FakeLanguageVersionSettings.kt b/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FakeLanguageVersionSettings.kt
new file mode 100644
index 000000000000..872b26f4b037
--- /dev/null
+++ b/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FakeLanguageVersionSettings.kt
@@ -0,0 +1,17 @@
+package io.gitlab.arturbosch.detekt.test
+
+import org.jetbrains.kotlin.config.AnalysisFlags
+import org.jetbrains.kotlin.config.ApiVersion
+import org.jetbrains.kotlin.config.ExplicitApiMode
+import org.jetbrains.kotlin.config.LanguageVersion
+import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
+
+@Suppress("FunctionName")
+fun FakeLanguageVersionSettings(
+    mode: ExplicitApiMode = ExplicitApiMode.DISABLED,
+): LanguageVersionSettingsImpl = LanguageVersionSettingsImpl(
+    languageVersion = LanguageVersion.LATEST_STABLE,
+    apiVersion = ApiVersion.LATEST_STABLE,
+    analysisFlags = mapOf(AnalysisFlags.explicitApiMode to mode),
+    specificFeatures = emptyMap(),
+)
diff --git a/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/RuleExtensions.kt b/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/RuleExtensions.kt
index 5f3540ffbbc6..5ed45819c4a4 100644
--- a/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/RuleExtensions.kt
+++ b/detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/RuleExtensions.kt
@@ -4,7 +4,6 @@ import io.github.detekt.test.utils.KotlinAnalysisApiEngine
 import io.github.detekt.test.utils.KotlinEnvironmentContainer
 import io.github.detekt.test.utils.KotlinScriptEngine
 import io.github.detekt.test.utils.compileContentForTest
-import io.gitlab.arturbosch.detekt.api.CompilerResources
 import io.gitlab.arturbosch.detekt.api.Config
 import io.gitlab.arturbosch.detekt.api.Finding
 import io.gitlab.arturbosch.detekt.api.RequiresAnalysisApi
@@ -13,6 +12,7 @@ import io.gitlab.arturbosch.detekt.api.Rule
 import io.gitlab.arturbosch.detekt.api.RuleSet
 import io.gitlab.arturbosch.detekt.core.suppressors.isSuppressedBy
 import org.intellij.lang.annotations.Language
+import org.jetbrains.kotlin.config.LanguageVersionSettings
 import org.jetbrains.kotlin.config.languageVersionSettings
 import org.jetbrains.kotlin.psi.KtFile
 
@@ -24,7 +24,7 @@ private val shouldCompileTestSnippetsAa: Boolean =
 
 fun Rule.lint(
     @Language("kotlin") content: String,
-    compilerResources: CompilerResources = FakeCompilerResources(),
+    languageVersionSettings: LanguageVersionSettings = FakeLanguageVersionSettings(),
     compile: Boolean = true,
 ): List<Finding> {
     require(this !is RequiresFullAnalysis) {
@@ -37,16 +37,14 @@ fun Rule.lint(
         KotlinAnalysisApiEngine.compile(content)
     }
     val ktFile = compileContentForTest(content)
-    return visitFile(ktFile, compilerResources = compilerResources).filterSuppressed(this)
+    return visitFile(ktFile, languageVersionSettings = languageVersionSettings).filterSuppressed(this)
 }
 
 fun <T> T.lintWithContext(
     environment: KotlinEnvironmentContainer,
     @Language("kotlin") content: String,
     @Language("kotlin") vararg additionalContents: String,
-    compilerResources: CompilerResources = CompilerResources(
-        environment.configuration.languageVersionSettings
-    ),
+    languageVersionSettings: LanguageVersionSettings = environment.configuration.languageVersionSettings,
     compile: Boolean = true,
 ): List<Finding> where T : Rule, T : RequiresFullAnalysis {
     if (compile && shouldCompileTestSnippets) {
@@ -61,7 +59,7 @@ fun <T> T.lintWithContext(
     }
     setBindingContext(environment.createBindingContext(listOf(ktFile) + additionalKtFiles))
 
-    return visitFile(ktFile, compilerResources).filterSuppressed(this)
+    return visitFile(ktFile, languageVersionSettings).filterSuppressed(this)
 }
 
 fun <T> T.lintWithContext(
@@ -69,19 +67,17 @@ fun <T> T.lintWithContext(
     @Language("kotlin") content: String,
 ): List<Finding> where T : Rule, T : RequiresAnalysisApi {
     val ktFile = KotlinAnalysisApiEngine.compile(content)
-
-    val compilerResources = CompilerResources(
-        environment.configuration.languageVersionSettings
-    )
-
-    return visitFile(ktFile, compilerResources).filterSuppressed(this)
+    return visitFile(ktFile, environment.configuration.languageVersionSettings).filterSuppressed(this)
 }
 
-fun Rule.lint(ktFile: KtFile, compilerResources: CompilerResources = FakeCompilerResources()): List<Finding> {
+fun Rule.lint(
+    ktFile: KtFile,
+    languageVersionSettings: LanguageVersionSettings = FakeLanguageVersionSettings(),
+): List<Finding> {
     require(this !is RequiresFullAnalysis) {
         "${this.ruleName} requires full analysis so you should use lintWithContext instead of lint"
     }
-    return visitFile(ktFile, compilerResources = compilerResources).filterSuppressed(this)
+    return visitFile(ktFile, languageVersionSettings = languageVersionSettings).filterSuppressed(this)
 }
 
 private fun List<Finding>.filterSuppressed(rule: Rule): List<Finding> =