private static boolean isValidTypeForSwitch(@Nullable PsiType type, PsiElement context) {
    if (type instanceof PsiClassType) {
      PsiClass resolvedClass = ((PsiClassType)type).resolve();
      if (resolvedClass == null) {
        return false;
      }
      return (PsiUtil.isAvailable(JavaFeature.ENUMS, context) && 
              (resolvedClass.isEnum() || isSuitablePrimitiveType(PsiPrimitiveType.getUnboxedType(type)))) || 
             (PsiUtil.isAvailable(JavaFeature.STRING_SWITCH, context) && 
              CommonClassNames.JAVA_LANG_STRING.equals(resolvedClass.getQualifiedName()));
    }
    return isSuitablePrimitiveType(type);
  }
private static boolean isValidTypeForSwitch(@Nullable PsiType type, PsiElement context)