Increase compatibility with different Google Gson version

This commit removes a dependency on an internal Gson class.