PsiElement (PsiClass aClass) { for (PsiLocalVariable variable : PsiTreeUtil.findChildrenOfType(aClass, PsiLocalVariable.class)) { if (assignmentVariableName.equals(variable.getName())) { final PsiAnonymousClass anonymousClass = PsiTreeUtil.findChildOfType(variable.getInitializer(), PsiAnonymousClass.class); assertNotNull(anonymousClass); return anonymousClass.getBaseClassReference().getParameterList(); } } throw new RuntimeException(String.format("Local variable '%s' isn't found in class '%s'", assignmentVariableName, className)); }