@NlsSafe
  @Nullable
  public static String getPackageName(@NotNull PsiClass aClass) {
    PsiClass topClass = getTopLevelClass(aClass);
    if (topClass != null) {
      String fqName = topClass.getQualifiedName();
      if (fqName != null) {
        return StringUtil.getPackageName(fqName);
      }
    }

    PsiFile file = aClass.getContainingFile();
    if (file instanceof PsiClassOwner) {
      return ((PsiClassOwner)file).getPackageName();
    }

    return null;
  }
@NlsSafe
  @Nullable
  public static String getPackageName(@NotNull PsiClass aClass)