void (Consumer<? super @NlsSafe @Nullable Collection<IdeKotlinVersion>> onFinish) { JarRepositoryManager.getAvailableVersions(project, RepositoryLibraryDescription.findDescription( KotlinArtifactConstants.KOTLIN_MAVEN_GROUP_ID, KotlinArtifactConstants.KOTLIN_DIST_FOR_JPS_META_ARTIFACT_ID)) .onProcessed(distVersions -> { if (distVersions == null) { onFinish.accept(null); return; } JarRepositoryManager.getAvailableVersions(project, RepositoryLibraryDescription.findDescription( KotlinArtifactConstants.KOTLIN_MAVEN_GROUP_ID, KotlinArtifactConstants.KOTLIN_JPS_PLUGIN_PLUGIN_ARTIFACT_ID)) .onProcessed(jpsClassPathVersions -> { if (jpsClassPathVersions == null) { onFinish.accept(null); return; } KotlinVersion min = KotlinJpsPluginSettings.getJpsMinimumSupportedVersion(); KotlinVersion max = KotlinJpsPluginSettings.getJpsMaximumSupportedVersion(); HashSet<IdeKotlinVersion> ideKotlinVersions = new HashSet<>(); for (String version : distVersions) { if (!jpsClassPathVersions.contains(version)) continue; IdeKotlinVersion parsedVersion = IdeKotlinVersion.opt(version); if (parsedVersion != null) { KotlinVersion parsedKotlinVersion = parsedVersion.getKotlinVersion(); if (parsedKotlinVersion.compareTo(min) >= 0 && parsedKotlinVersion.compareTo(max) <= 0) { ideKotlinVersions.add(parsedVersion); } } } onFinish.accept(ideKotlinVersions); }); }); }