ContextType (@NotNull ElementContext elementContext) { UMethod callingMethod; var method = UastContextKt.toUElement(elementContext.getElement(), UMethod.class); if (method != null) { callingMethod = method; } else { UCallExpression callExpression = UastContextKt.toUElement(elementContext.getElement(), UCallExpression.class); if (callExpression == null) return Unsure.INSTANCE; callingMethod = UastUtils.getParentOfType(callExpression, UMethod.class); } if (callingMethod == null) return Unsure.INSTANCE; PsiMethod psiCallingMethod = callingMethod.getJavaPsi(); if (AnnotationUtil.findAnnotation(psiCallingMethod, myNonBlockingAnnotations, false) != null) { return NonBlocking.INSTANCE; } if (AnnotationUtil.findAnnotation(psiCallingMethod, myBlockingAnnotations, false) != null) { // @Blocking on method overrides @NonBlocking on class return Blocking.INSTANCE; } PsiClass containingClass = psiCallingMethod.getContainingClass(); boolean isClassAnnotated = containingClass != null && AnnotationUtil.findAnnotation(containingClass, myNonBlockingAnnotations, false) != null; return isClassAnnotated ? NonBlocking.INSTANCE : Unsure.INSTANCE; }