@Nullable
 private static FqName findMainClass(
     @NotNull GenerationState generationState, @NotNull List<KtFile> files) {
   MainFunctionDetector mainFunctionDetector =
       new MainFunctionDetector(generationState.getBindingContext());
   FqName mainClass = null;
   for (KtFile file : files) {
     if (mainFunctionDetector.hasMain(file.getDeclarations())) {
       if (mainClass != null) {
         // more than one main
         return null;
       }
       FqName fqName = file.getPackageFqName();
       mainClass = JvmFileClassUtil.getFileClassInfoNoResolve(file).getFacadeClassFqName();
     }
   }
   return mainClass;
 }
  @Nullable
  static KtClass getClassDeclarationInFile(KtFile jetFile) {
    KtClass tempSingleDeclaration = null;

    for (KtDeclaration ktDeclaration : jetFile.getDeclarations()) {
      if (ktDeclaration instanceof KtClass) {
        KtClass declaration = (KtClass) ktDeclaration;

        if (tempSingleDeclaration == null) {
          tempSingleDeclaration = declaration;
        } else {
          // There are several class declarations in file
          return null;
        }
      }
    }

    return tempSingleDeclaration;
  }