Sdk (@NotNull PsiElement element) { final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element); if (virtualFile == null) return null; final List<OrderEntry> entries = ProjectRootManager.getInstance(element.getProject()).getFileIndex().getOrderEntriesForFile(virtualFile); for (OrderEntry orderEntry : entries) { if (orderEntry instanceof JdkOrderEntry entry) { Sdk jdk = entry.getJdk(); if (jdk != null) return jdk; } } return null; }