private static @Nullable PsiClassType getServiceType(PsiElement position) {
    if (position.getParent() instanceof PsiJavaCodeReferenceElement) {
      PsiElement refList = position.getParent().getParent();
      if (refList instanceof PsiReferenceList) {
        PsiElement parent = refList.getParent();
        if (parent instanceof PsiProvidesStatement) {
          return ((PsiProvidesStatement)parent).getInterfaceType();
        }
      }
    }
    return null;
  }
private static @Nullable PsiClassType getServiceType(PsiElement position)