Sdk (@NotNull Project project) { Project defaultProject = ProjectManager.getInstance().getDefaultProject(); ProjectRootManager defaultProjectManager = ProjectRootManager.getInstance(defaultProject); Sdk defaultProjectSdk = defaultProjectManager.getProjectSdk(); if (defaultProjectSdk != null) return null; ProjectJdkTable projectJdkTable = ProjectJdkTable.getInstance(); SdkType sdkType = ExternalSystemJdkUtil.getJavaSdkType(); return projectJdkTable.getSdksOfType(sdkType).stream() .filter(it -> it.getHomePath() != null && JdkUtil.checkForJre(it.getHomePath())) .filter(it -> MavenWslUtil.tryGetWslDistributionForPath(it.getHomePath()) == MavenWslUtil.tryGetWslDistribution(project)) .max(sdkType.versionComparator()) .orElse(null); }