PsiClass (String shortName, String packageName, Project project, GlobalSearchScope searchScope) { PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(packageName); if (aPackage != null) { int dollarIdx = shortName.indexOf("$"); String topLevelClassName = dollarIdx > 0 && dollarIdx < shortName.length() - 1 ? shortName.substring(0, dollarIdx) : shortName; PsiClass topLevelClass = ContainerUtil.find(aPackage.getClasses(searchScope), aClass -> topLevelClassName.equals(aClass.getName())); if (topLevelClass != null && !topLevelClassName.equals(shortName)) { String innerClassName = shortName.substring(dollarIdx + 1); return ClassUtil.findPsiClass(PsiManager.getInstance(project), innerClassName, topLevelClass, true); } return topLevelClass; } if (packageName.isEmpty()) { return null; } PsiClass topClass = findClass(StringUtil.getShortName(packageName), StringUtil.getPackageName(packageName), project, searchScope); if (topClass != null) { return topClass.findInnerClassByName(shortName, true); } return null; }