@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; }
@NotNull protected Class<?> generateFileClass() { FqName fileClassFqName = JvmFileClassUtil.getFileClassInfoNoResolve(myFiles.getPsiFile()).getFileClassFqName(); return generateClass(fileClassFqName.asString()); }