Version (@NotNull Project project, @NotNull Module module) { return CachedValuesManager.getManager(project).getCachedValue(module, () -> { String version = null; JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); PsiClass aClass = psiFacade.findClass("org.testng.internal.Version", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module)); if (aClass != null) { PsiField versionField = aClass.findFieldByName("VERSION", false); if (versionField != null) { PsiExpression initializer = versionField.getInitializer(); if (initializer instanceof PsiLiteralExpression) { Object eval = ((PsiLiteralExpression)initializer).getValue(); if (eval instanceof String) { version = (String)eval; } } else { version = String.valueOf(Integer.MAX_VALUE); } } } if (version == null) return null; return CachedValueProvider.Result.createSingleDependency(Version.parseVersion(version), ProjectRootManager.getInstance(module.getProject())); }); }