@Nullable
  private static PsiJavaModule findDescriptor(@Nullable PsiElement psiElement) {
    if (psiElement == null) return null;
    if (psiElement instanceof PsiPackage psiPackage) {
      PsiDirectory[] directories = psiPackage.getDirectories(psiPackage.getResolveScope());
      for (PsiDirectory directory : directories) {
        PsiJavaModule descriptor = JavaModuleGraphUtil.findDescriptorByElement(directory);
        if (descriptor != null) return descriptor;
      }
    }
    else {
      return JavaModuleGraphUtil.findDescriptorByElement(psiElement);
    }
    return null;
  }
@Nullable
  private static PsiJavaModule findDescriptor(@Nullable PsiElement psiElement)