mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
[devkit] KTIJ-29667 cleanup
GitOrigin-RevId: e6332f53bf9f3d0279963ed15808c66eedd48e81
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ac8807e29c
commit
e1e5ccb5fb
@@ -9,8 +9,8 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getCallNameExpression
|
||||
|
||||
internal val requiresBlockingContextAnnotation = FqName(REQUIRES_BLOCKING_CONTEXT_ANNOTATION)
|
||||
internal val requiresBlockingContextAnnotationId = ClassId.topLevel(requiresBlockingContextAnnotation)
|
||||
internal val RequiresBlockingContextAnnotation: FqName = FqName(REQUIRES_BLOCKING_CONTEXT_ANNOTATION)
|
||||
internal val RequiresBlockingContextAnnotationId: ClassId = ClassId.topLevel(RequiresBlockingContextAnnotation)
|
||||
|
||||
internal abstract class BlockingContextFunctionBodyVisitor : KtTreeVisitorVoid() {
|
||||
override fun visitLambdaExpression(lambdaExpression: KtLambdaExpression): Unit = Unit
|
||||
|
||||
@@ -110,7 +110,7 @@ internal class ForbiddenInSuspectContextMethodInspection : LocalInspectionTool()
|
||||
val calledSymbol = functionCall?.partiallyAppliedSymbol?.symbol
|
||||
|
||||
if (calledSymbol !is KtNamedSymbol) return
|
||||
val hasAnnotation = calledSymbol.hasAnnotation(requiresBlockingContextAnnotationId)
|
||||
val hasAnnotation = calledSymbol.hasAnnotation(RequiresBlockingContextAnnotationId)
|
||||
|
||||
if (!hasAnnotation) {
|
||||
if (calledSymbol is KtFunctionSymbol) {
|
||||
|
||||
@@ -43,7 +43,7 @@ internal class KtCallingFunctionShouldBeRequiresBlockingContextVisitorProvider :
|
||||
val calledSymbol = functionCall?.partiallyAppliedSymbol?.symbol
|
||||
|
||||
if (calledSymbol !is KtNamedSymbol) return
|
||||
val hasAnnotation = calledSymbol.hasAnnotation(requiresBlockingContextAnnotationId)
|
||||
val hasAnnotation = calledSymbol.hasAnnotation(RequiresBlockingContextAnnotationId)
|
||||
|
||||
if (!hasAnnotation) {
|
||||
if (calledSymbol is KtFunctionSymbol && calledSymbol.isInline) {
|
||||
@@ -65,13 +65,22 @@ internal class KtCallingFunctionShouldBeRequiresBlockingContextVisitorProvider :
|
||||
}
|
||||
|
||||
private class AnnotateFix(
|
||||
element: PsiElement, callingMethod: KtNamedFunction
|
||||
element: PsiElement,
|
||||
callingMethod: KtNamedFunction,
|
||||
) : QuickFixWithReferenceToElement<KtNamedFunction>(element, callingMethod) {
|
||||
|
||||
override fun getFamilyName(): String = DevKitBundle.message("inspections.calling.method.should.be.rbc.annotated.annotate.fix")
|
||||
|
||||
override fun getText(): String = familyName
|
||||
|
||||
override fun invoke(project: Project, file: PsiFile, editor: Editor?, startElement: PsiElement, endElement: PsiElement) {
|
||||
referencedElement.element!!.addAnnotation(requiresBlockingContextAnnotation)
|
||||
override fun invoke(
|
||||
project: Project,
|
||||
file: PsiFile,
|
||||
editor: Editor?,
|
||||
startElement: PsiElement,
|
||||
endElement: PsiElement,
|
||||
) {
|
||||
referencedElement.element!!
|
||||
.addAnnotation(RequiresBlockingContextAnnotation)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user