boolean (@Nullable PsiVariable variable, @NonNls String @NotNull ... typeNames) { if (variable == null) { return false; } PsiType type = variable.getType(); if (type instanceof PsiDisjunctionType) { type = ((PsiDisjunctionType)type).getLeastUpperBound(); } for (String typeName : typeNames) { if (InheritanceUtil.isInheritor(type, typeName)) { return true; } } return false; }