Code review comment: We might have to do a null check for `emitResult.diagnostics()` right?

Code under review:
public void execute(Project project) {
        this.out.println();

        if (!project.buildOptions().nativeImage()) {
            this.out.println("Generating executable");
        }

        this.currentDir = Paths.get(System.getProperty(USER_DIR));
        Target target;

        try {
            if (project.kind().equals(ProjectKind.BUILD_PROJECT)) {
                target = new Target(project.targetDir());
            } else {
                target = new Target(Files.createTempDirectory("ballerina-cache" + System.nanoTime()));
                target.setOutputPath(getExecutablePath(project));
            }
        } catch (IOException e) {
            throw createLauncherException("unable to resolve target path:" + e.getMessage());
        } catch (ProjectException e) {
            throw createLauncherException("unable to create executable:" + e.getMessage());
        }

        Path executablePath;
        try {
            executablePath = target.getExecutablePath(project.currentPackage()).toAbsolutePath().normalize();
        } catch (IOException e) {
            throw createLauncherException(e.getMessage());
        }
        try {
            PackageCompilation pkgCompilation = project.currentPackage().getCompilation();
            JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_17);
            long start = 0;
            if (project.buildOptions().dumpBuildTime()) {
                start = System.currentTimeMillis();
            }
            EmitResult emitResult;
            if (project.buildOptions().nativeImage() && project.buildOptions().cloud().equals("")) {
                String warnings = GraalVMCompatibilityUtils.getAllWarnings(
                        project.currentPackage(), jBallerinaBackend.targetPlatform().code(), false);
                if (!warnings.isEmpty()) {
                    out.println(warnings);
                }
                emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.GRAAL_EXEC, executablePath);
            } else {
                emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, executablePath);
            }

            if (project.buildOptions().dumpBuildTime()) {
                BuildTime.getInstance().emitArtifactDuration = System.currentTimeMillis() - start;
                BuildTime.getInstance().compile = false;
            }

            
            if (!jBallerinaBackend.conflictedJars().isEmpty()) {
                out.println("\twarning: Detected conflicting jar files:");
                for (JBallerinaBackend.JarConflict conflict : jBallerinaBackend.conflictedJars()) {
                    out.println(conflict.getWarning(project.buildOptions().listConflictedClasses()));
                }
            }

            
            if (!emitResult.diagnostics().diagnostics().isEmpty()) {
                emitResult.diagnostics().diagnostics().forEach(d -> out.println("\n" + d.toString()));
            }

        } catch (ProjectException e) {
            throw createLauncherException(e.getMessage());
        }

        if (!project.buildOptions().nativeImage()) {
            Path relativePathToExecutable = currentDir.relativize(executablePath);

            if (project.buildOptions().getTargetPath() != null) {
                this.out.println("\t" + relativePathToExecutable);
            } else {
                if (relativePathToExecutable.toString().contains("..") ||
                        relativePathToExecutable.toString().contains("." + File.separator)) {
                    this.out.println("\t" + executablePath);
                } else {
                    this.out.println("\t" + relativePathToExecutable);
                }
            }
        }

        
        
        notifyPlugins(project, target);
    }

Line commented on: if (!emitResult.diagnostics().diagnostics().isEmpty()) {

Revised code:
public void execute(Project project) {
        this.out.println();

        if (!project.buildOptions().nativeImage()) {
            this.out.println("Generating executable");
        }

        this.currentDir = Paths.get(System.getProperty(USER_DIR));
        Target target;

        try {
            if (project.kind().equals(ProjectKind.BUILD_PROJECT)) {
                target = new Target(project.targetDir());
            } else {
                target = new Target(Files.createTempDirectory("ballerina-cache" + System.nanoTime()));
                target.setOutputPath(getExecutablePath(project));
            }
        } catch (IOException e) {
            throw createLauncherException("unable to resolve target path:" + e.getMessage());
        } catch (ProjectException e) {
            throw createLauncherException("unable to create executable:" + e.getMessage());
        }

        Path executablePath;
        try {
            executablePath = target.getExecutablePath(project.currentPackage()).toAbsolutePath().normalize();
        } catch (IOException e) {
            throw createLauncherException(e.getMessage());
        }
        try {
            PackageCompilation pkgCompilation = project.currentPackage().getCompilation();
            JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_17);
            long start = 0;
            if (project.buildOptions().dumpBuildTime()) {
                start = System.currentTimeMillis();
            }
            EmitResult emitResult;
            if (project.buildOptions().nativeImage() && project.buildOptions().cloud().equals("")) {
                String warnings = GraalVMCompatibilityUtils.getAllWarnings(
                        project.currentPackage(), jBallerinaBackend.targetPlatform().code(), false);
                if (!warnings.isEmpty()) {
                    out.println(warnings);
                }
                emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.GRAAL_EXEC, executablePath);
            } else {
                emitResult = jBallerinaBackend.emit(JBallerinaBackend.OutputType.EXEC, executablePath);
            }

            if (project.buildOptions().dumpBuildTime()) {
                BuildTime.getInstance().emitArtifactDuration = System.currentTimeMillis() - start;
                BuildTime.getInstance().compile = false;
            }

            
            if (!jBallerinaBackend.conflictedJars().isEmpty()) {
                out.println("\twarning: Detected conflicting jar files:");
                for (JBallerinaBackend.JarConflict conflict : jBallerinaBackend.conflictedJars()) {
                    out.println(conflict.getWarning(project.buildOptions().listConflictedClasses()));
                }
            }

            
            if (!emitResult.diagnostics().diagnostics().isEmpty()) {
                emitResult.diagnostics().diagnostics().forEach(d -> out.println("\n" + d.toString()));
            }

        } catch (ProjectException e) {
            throw createLauncherException(e.getMessage());
        }

        if (!project.buildOptions().nativeImage()) {
            Path relativePathToExecutable = currentDir.relativize(executablePath);

            if (project.buildOptions().getTargetPath() != null) {
                this.out.println("\t" + relativePathToExecutable);
            } else {
                if (relativePathToExecutable.toString().contains("..") ||
                        relativePathToExecutable.toString().contains("." + File.separator)) {
                    this.out.println("\t" + executablePath);
                } else {
                    this.out.println("\t" + relativePathToExecutable);
                }
            }
        }

        
        
        notifyPlugins(project, target);
    }