mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-05 00:21:31 +00:00
Fix of "Replace array of with array literal"
Do not apply if module does not support the relevant feature Related to KT-17164
This commit is contained in:
@@ -26,7 +26,7 @@ import com.intellij.psi.PsiElementVisitor
|
||||
import org.jetbrains.kotlin.builtins.BuiltInsPackageFragment
|
||||
import org.jetbrains.kotlin.config.LanguageFeature.ArrayLiteralsInAnnotations
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.CollectionLiteralResolver
|
||||
@@ -43,8 +43,7 @@ class ReplaceArrayOfWithLiteralInspection : AbstractKotlinInspection() {
|
||||
override fun visitCallExpression(expression: KtCallExpression) {
|
||||
super.visitCallExpression(expression)
|
||||
|
||||
val project = expression.project
|
||||
if (!project.getLanguageVersionSettings().supportsFeature(ArrayLiteralsInAnnotations) &&
|
||||
if (!expression.languageVersionSettings.supportsFeature(ArrayLiteralsInAnnotations) &&
|
||||
!ApplicationManager.getApplication().isUnitTestMode) return
|
||||
|
||||
val calleeExpression = expression.calleeExpression as? KtNameReferenceExpression ?: return
|
||||
|
||||
Reference in New Issue
Block a user