[analysis] remove redundant diagnostic suppression

This commit is contained in:
Dmitry Gridin
2022-08-12 21:12:35 +02:00
parent 6a83bcf349
commit 8dbdea39da
9 changed files with 7 additions and 19 deletions
@@ -455,7 +455,7 @@ internal class KtFe10CallResolver(
) )
} }
} }
@Suppress("UNCHECKED_CAST")
return KtSimpleFunctionCall( return KtSimpleFunctionCall(
partiallyAppliedSymbol, partiallyAppliedSymbol,
argumentMapping, argumentMapping,
@@ -20,7 +20,6 @@ internal class ValidityAwareCachedValue<T>(
) : ReadOnlyProperty<Any, T> { ) : ReadOnlyProperty<Any, T> {
private val lazyValue = lazy(LazyThreadSafetyMode.PUBLICATION, init) private val lazyValue = lazy(LazyThreadSafetyMode.PUBLICATION, init)
@Suppress("UNCHECKED_CAST")
override fun getValue(thisRef: Any, property: KProperty<*>): T { override fun getValue(thisRef: Any, property: KProperty<*>): T {
token.assertIsValidAndAccessible() token.assertIsValidAndAccessible()
return lazyValue.value return lazyValue.value
@@ -42,10 +42,7 @@ class KtFirAnalysisSessionProvider(project: Project) : CachingKtAnalysisSessionP
override fun createAnalysisSession( override fun createAnalysisSession(
firResolveSession: LLFirResolveSession, firResolveSession: LLFirResolveSession,
token: KtLifetimeToken, token: KtLifetimeToken,
): KtAnalysisSession { ): KtAnalysisSession = KtFirAnalysisSession.createAnalysisSessionByFirResolveSession(firResolveSession, token)
@Suppress("DEPRECATION")
return KtFirAnalysisSession.createAnalysisSessionByFirResolveSession(firResolveSession, token)
}
} }
@@ -20,7 +20,6 @@ class ValidityAwareCachedValue<T>(
) : ReadOnlyProperty<Any, T> { ) : ReadOnlyProperty<Any, T> {
private val lazyValue = lazy(LazyThreadSafetyMode.PUBLICATION, init) private val lazyValue = lazy(LazyThreadSafetyMode.PUBLICATION, init)
@Suppress("UNCHECKED_CAST")
override fun getValue(thisRef: Any, property: KProperty<*>): T { override fun getValue(thisRef: Any, property: KProperty<*>): T {
token.assertIsValidAndAccessible() token.assertIsValidAndAccessible()
return lazyValue.value return lazyValue.value
@@ -41,13 +41,10 @@ public abstract class KtSignatureSubstitutor : KtAnalysisSessionComponent() {
substitutor: KtSubstitutor substitutor: KtSubstitutor
): KtVariableLikeSignature<S> ): KtVariableLikeSignature<S>
@Suppress("UNCHECKED_CAST") public open fun <S : KtCallableSymbol> substitute(symbol: S, substitutor: KtSubstitutor): KtCallableSignature<S> = when (symbol) {
public open fun <S : KtCallableSymbol> substitute(symbol: S, substitutor: KtSubstitutor): KtCallableSignature<S> { is KtFunctionLikeSymbol -> substitute(symbol, substitutor)
return when (symbol) { is KtVariableLikeSymbol -> substitute(symbol, substitutor)
is KtFunctionLikeSymbol -> substitute(symbol, substitutor) else -> unexpectedElementError("symbol", symbol)
is KtVariableLikeSymbol -> substitute(symbol, substitutor)
else -> unexpectedElementError("symbol", symbol)
}
} }
public abstract fun <S : KtFunctionLikeSymbol> substitute(symbol: S, substitutor: KtSubstitutor): KtFunctionLikeSignature<S> public abstract fun <S : KtFunctionLikeSymbol> substitute(symbol: S, substitutor: KtSubstitutor): KtFunctionLikeSignature<S>
@@ -19,7 +19,7 @@ public class ConcurrentMapBasedCache<K, V>(public val map: ConcurrentMap<K, Any>
public object NullValue public object NullValue
@Suppress("NOTHING_TO_INLINE", "UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
public fun <V> Any.nullValueToNull(): V = when (this) { public fun <V> Any.nullValueToNull(): V = when (this) {
NullValue -> null NullValue -> null
else -> this else -> this
@@ -54,10 +54,8 @@ abstract class AbstractKtReference<T : KtElement>(element: T) : PsiPolyVariantRe
override fun toString() = this::class.java.simpleName + ": " + expression.text override fun toString() = this::class.java.simpleName + ": " + expression.text
@Suppress("UNUSED_PARAMETER")
protected open fun canBeReferenceTo(candidateTarget: PsiElement): Boolean = true protected open fun canBeReferenceTo(candidateTarget: PsiElement): Boolean = true
@Suppress("UNUSED_PARAMETER")
protected open fun isReferenceToImportAlias(alias: KtImportAlias): Boolean = false protected open fun isReferenceToImportAlias(alias: KtImportAlias): Boolean = false
override fun isReferenceTo(candidateTarget: PsiElement): Boolean { override fun isReferenceTo(candidateTarget: PsiElement): Boolean {
@@ -152,7 +152,6 @@ abstract class KtLightMethodImpl protected constructor(
override fun getBody() = null override fun getBody() = null
@Suppress("DEPRECATION")
abstract override fun findDeepestSuperMethod(): PsiMethod? abstract override fun findDeepestSuperMethod(): PsiMethod?
abstract override fun findDeepestSuperMethods(): Array<out PsiMethod> abstract override fun findDeepestSuperMethods(): Array<out PsiMethod>
@@ -14,7 +14,6 @@ internal class FirThreadSafeCacheWithPostCompute<K : Any, V, CONTEXT, DATA>(
) : FirCache<K, V, CONTEXT>() { ) : FirCache<K, V, CONTEXT>() {
private val map = ConcurrentHashMap<K, ValueWithPostCompute<K, V, DATA>>() private val map = ConcurrentHashMap<K, ValueWithPostCompute<K, V, DATA>>()
@Suppress("UNCHECKED_CAST")
override fun getValue(key: K, context: CONTEXT): V = override fun getValue(key: K, context: CONTEXT): V =
map.getOrPut(key) { map.getOrPut(key) {
ValueWithPostCompute( ValueWithPostCompute(