String (@NotNull Module module, boolean fallbackToInternal) { String jdkVersion = null; Optional<Sdk> sdk = Optional.ofNullable(ModuleRootManager.getInstance(module).getSdk()); if (sdk.isEmpty()) { Optional<JdkOrderEntry> jdkEntry = Arrays.stream(ModuleRootManager.getInstance(module).getOrderEntries()) .filter(JdkOrderEntry.class::isInstance) .map(JdkOrderEntry.class::cast) .findFirst(); if (jdkEntry.isPresent()) { jdkVersion = jdkEntry.get().getJdkName(); } } else { jdkVersion = sdk.get().getVersionString(); } if (jdkVersion == null && fallbackToInternal) { jdkVersion = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk().getVersionString(); } if (jdkVersion != null) { final int quoteIndex = jdkVersion.indexOf('"'); if (quoteIndex != -1) { jdkVersion = jdkVersion.substring(quoteIndex + 1, jdkVersion.length() - 1); } } return jdkVersion; }