Fix compiler warnings in compiler code
This commit is contained in:
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.asJava.builder
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.impl.compiled.ClsFileImpl
|
||||
@@ -44,7 +43,7 @@ fun buildLightClass(
|
||||
val project = files.first().project
|
||||
|
||||
try {
|
||||
val classBuilderFactory = KotlinLightClassBuilderFactory(createJavaFileStub(project, packageFqName, files))
|
||||
val classBuilderFactory = KotlinLightClassBuilderFactory(createJavaFileStub(packageFqName, files))
|
||||
val state = GenerationState.Builder(
|
||||
project,
|
||||
classBuilderFactory,
|
||||
@@ -77,7 +76,7 @@ fun buildLightClass(
|
||||
}
|
||||
}
|
||||
|
||||
private fun createJavaFileStub(project: Project, packageFqName: FqName, files: Collection<KtFile>): PsiJavaFileStub {
|
||||
private fun createJavaFileStub(packageFqName: FqName, files: Collection<KtFile>): PsiJavaFileStub {
|
||||
val javaFileStub = PsiJavaFileStubImpl(packageFqName.asString(), /*compiled = */true)
|
||||
javaFileStub.psiFactory = ClsWrapperStubPsiFactory.INSTANCE
|
||||
|
||||
|
||||
+5
-3
@@ -14,7 +14,6 @@ import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.impl.InheritanceImplUtil
|
||||
import com.intellij.psi.impl.PsiSubstitutorImpl
|
||||
import com.intellij.psi.impl.java.stubs.PsiJavaFileStub
|
||||
import com.intellij.psi.impl.source.PsiImmediateClassType
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil
|
||||
@@ -22,7 +21,10 @@ import com.intellij.psi.scope.PsiScopeProcessor
|
||||
import com.intellij.psi.search.SearchScope
|
||||
import com.intellij.psi.stubs.IStubElementType
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.psi.util.*
|
||||
import com.intellij.psi.util.CachedValue
|
||||
import com.intellij.psi.util.CachedValueProvider
|
||||
import com.intellij.psi.util.CachedValuesManager
|
||||
import com.intellij.psi.util.PsiUtilCore
|
||||
import com.intellij.util.IncorrectOperationException
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService
|
||||
@@ -489,7 +491,7 @@ abstract class KtLightClassForSourceDeclaration(
|
||||
return PsiSubstitutor.EMPTY
|
||||
}
|
||||
val javaLangEnumsTypeParameter = ancestor.typeParameters.firstOrNull() ?: return PsiSubstitutor.EMPTY
|
||||
return PsiSubstitutorImpl.createSubstitutor(
|
||||
return PsiSubstitutor.createSubstitutor(
|
||||
mapOf(
|
||||
javaLangEnumsTypeParameter to PsiImmediateClassType(this, PsiSubstitutor.EMPTY)
|
||||
)
|
||||
|
||||
@@ -470,8 +470,11 @@ inline fun <T> runReadAction(crossinline runnable: () -> T): T {
|
||||
return ApplicationManager.getApplication().runReadAction(Computable { runnable() })
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun KtClassOrObject.safeIsLocal(): Boolean = runReadAction { this.isLocal }
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun KtFile.safeIsScript() = runReadAction { this.isScript() }
|
||||
|
||||
inline fun KtFile.safeScript() = runReadAction { this.script }
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun KtFile.safeScript() = runReadAction { this.script }
|
||||
|
||||
@@ -253,6 +253,7 @@ open class KtLightMethodImpl protected constructor(
|
||||
|
||||
override fun getBody() = null
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
override fun findDeepestSuperMethod() = clsDelegate.findDeepestSuperMethod()
|
||||
|
||||
override fun findDeepestSuperMethods() = clsDelegate.findDeepestSuperMethods()
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ internal class KtLightParameterImpl(
|
||||
private val clsDelegateProvider: () -> PsiParameter?,
|
||||
private val index: Int,
|
||||
method: KtLightMethod
|
||||
) : LightParameter(dummyDelegate.name ?: "p$index", dummyDelegate.type, method, KotlinLanguage.INSTANCE),
|
||||
) : LightParameter(dummyDelegate.name, dummyDelegate.type, method, KotlinLanguage.INSTANCE),
|
||||
KtLightDeclaration<KtParameter, PsiParameter>, KtLightParameter {
|
||||
|
||||
private val lazyDelegate by lazyPub { clsDelegateProvider() ?: dummyDelegate }
|
||||
@@ -33,7 +33,7 @@ internal class KtLightParameterImpl(
|
||||
|
||||
override fun getType(): PsiType = lazyDelegate.type
|
||||
|
||||
override fun getName(): String = dummyDelegate.name ?: lazyDelegate.name ?: super.getName()
|
||||
override fun getName(): String = dummyDelegate.name
|
||||
|
||||
private val lightModifierList by lazyPub { KtLightSimpleModifierList(this, emptySet()) }
|
||||
|
||||
|
||||
-1
@@ -105,7 +105,6 @@ internal fun PsiAnnotation.tryConvertAsRetention(support: KtUltraLightSupport):
|
||||
|
||||
val convertedValue = extractAnnotationFqName("value")
|
||||
?.let { retentionMapping[it] }
|
||||
?: null
|
||||
|
||||
convertedValue ?: return null
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ abstract class KtLightAbstractAnnotation(parent: PsiElement, computeDelegate: La
|
||||
|
||||
override fun getOwner() = parent as? PsiAnnotationOwner
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
override fun getMetaData() = clsDelegate.metaData
|
||||
|
||||
override fun getParameterList() = clsDelegate.parameterList
|
||||
@@ -91,6 +92,7 @@ class KtLightAnnotationForSourceEntry(
|
||||
|
||||
override fun getOwner() = parent as? PsiAnnotationOwner
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
override fun getMetaData() = lazyClsDelegate?.value?.metaData
|
||||
|
||||
override fun getQualifiedName() = qualifiedName
|
||||
|
||||
Reference in New Issue
Block a user