PsiClass (@NotNull String className, @NotNull PsiClass topLevelClass) { if (className.indexOf('.') < 0) { return className.equals(topLevelClass.getName()) ? topLevelClass : null; } Iterator<String> segments = StringUtil.split(className, ".").iterator(); if (!segments.hasNext() || !segments.next().equals(topLevelClass.getName())) { return null; } PsiClass curClass = topLevelClass; while (segments.hasNext()) { String innerClassName = segments.next(); PsiClass innerClass = curClass.findInnerClassByName(innerClassName, false); if (innerClass == null) { return null; } curClass = innerClass; } return curClass; }