Increase compatibility with different Google Gson versions

This commit removes a dependency on an internal Gson class.