String (@Nullable PsiExpression expression, @NonNls String @NotNull ... typeNames) { if (expression == null) { return null; } PsiType type = FunctionalExpressionUtils.getFunctionalExpressionType(expression); if (type == null) { return null; } if (type instanceof PsiDisjunctionType) { type = ((PsiDisjunctionType)type).getLeastUpperBound(); } for (String typeName : typeNames) { if (InheritanceUtil.isInheritor(type, typeName)) { return typeName; } } return null; }