Sdk (Artifact artifact, Project project) { final Set<Module> modules = ReadAction.compute(() -> ArtifactUtil.getModulesIncludedInArtifacts(Collections.singletonList(artifact), project)); if (modules.isEmpty()) { return null; } for (Module module : modules) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null) { final SdkTypeId sdkType = sdk.getSdkType(); if (sdkType instanceof JavaSdk && ((JavaSdk)sdkType).isOfVersionOrHigher(sdk, JavaSdkVersion.JDK_1_7)) { return sdk; } } } return null; }