docs: @SuppressWarnings("unchecked")
    public <T> T fromJson(JsonReader reader, Type typeOfT) throws JsonIOException, JsonSyntaxException {
      boolean isEmpty = true;
      boolean oldLenient = reader.isLenient();
      reader.setLenient(true);
      try {
        reader.peek();
        isEmpty = false;
        TypeToken<T> typeToken = (TypeToken<T>) TypeToken.get(typeOfT);
        TypeAdapter<T> typeAdapter = getAdapter(typeToken);
        T object = typeAdapter.read(reader);
        return object;
      } catch (EOFException e) {
        /*
         * For compatibility with JSON 1.5 and earlier, we return null for empty
         * documents instead of throwing.
         */
        if (isEmpty) {
          return null;
        }
        throw new JsonSyntaxException(e);
      } catch (IllegalStateException e) {
        throw new JsonSyntaxException(e);
      } catch (IOException e) {
        // TODO(inder): Figure out whether it is indeed right to rethrow this as JsonSyntaxException
        throw new JsonSyntaxException(e);
      } catch (AssertionError e) {
        AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
        error.initCause(e);
        throw error;
      } finally {
        reader.setLenient(oldLenient);
      }
    }