@Nullable
    private String getPackageName(@NotNull String className) {
      int dotPos;
      while ((dotPos = className.lastIndexOf('.')) > 0) {
        className = className.substring(0, dotPos);
        Boolean isPackage = myPackages.computeIfAbsent(className, packageName ->
          ReadAction.compute(() -> myPsiFacade.findPackage(packageName) != null));
        if (isPackage) return className;
      }
      return null;
    }
@Nullable
    private String getPackageName(@NotNull String className)