{"action":"created","issue":{"url":"https://api.github.com/repos/square/retrofit/issues/2851","repository_url":"https://api.github.com/repos/square/retrofit","labels_url":"https://api.github.com/repos/square/retrofit/issues/2851/labels{/name}","comments_url":"https://api.github.com/repos/square/retrofit/issues/2851/comments","events_url":"https://api.github.com/repos/square/retrofit/issues/2851/events","html_url":"https://github.com/square/retrofit/issues/2851","id":349545843,"node_id":"MDU6SXNzdWUzNDk1NDU4NDM=","number":2851,"title":"Optional class fields not working","user":{"login":"chronvas","id":8863897,"node_id":"MDQ6VXNlcjg4NjM4OTc=","avatar_url":"https://avatars0.githubusercontent.com/u/8863897?v=4","gravatar_id":"","url":"https://api.github.com/users/chronvas","html_url":"https://github.com/chronvas","followers_url":"https://api.github.com/users/chronvas/followers","following_url":"https://api.github.com/users/chronvas/following{/other_user}","gists_url":"https://api.github.com/users/chronvas/gists{/gist_id}","starred_url":"https://api.github.com/users/chronvas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chronvas/subscriptions","organizations_url":"https://api.github.com/users/chronvas/orgs","repos_url":"https://api.github.com/users/chronvas/repos","events_url":"https://api.github.com/users/chronvas/events{/privacy}","received_events_url":"https://api.github.com/users/chronvas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-10T14:51:05Z","updated_at":"2018-08-13T16:06:06Z","closed_at":"2018-08-13T16:06:06Z","author_association":"NONE","body":"What kind of issue is this?\r\n\r\n - [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do\r\n       something, or to understand why something isn't working the way you expect it to, use Stack\r\n       Overflow. https://stackoverflow.com/questions/tagged/retrofit\r\n\r\n - [x] Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests\r\n       get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9\r\n\r\n - [ ] Feature Request. Start by telling us what problem you’re trying to solve. Often a solution\r\n       already exists! Don’t send pull requests to implement new features without first getting our\r\n       support. Sometimes we leave features out on purpose to keep the project small.\r\n\r\n----\r\n\r\nOptionals in fields crashes in deserialization\r\nThe entire object can be Optional, but fields inside it cause crashes, either with JsonSyntaxException or with \"Failed to invoke com.google.common.base.Optional() with no args\" exception message.\r\n\r\nTo reproduce I've created these tests https://gist.github.com/chronvas/9c060ace6cac4ad8915fd187978b4328\r\n\r\nI know this will probably be considered as a language limitation and not a library bug, but IMO this needs to exist even in closed bugs since I suspect that it would save lots of time for other people.\r\nA few answers can be found here https://stackoverflow.com/questions/31922866/why-should-java-8s-optional-not-be-used-in-arguments\r\n\r\nThe obvious solution would be a retrofit specific Optional all together, alongside with a Converter Factory for that, but probably it's not that great of a solution. Any other solutions?"},"comment":{"url":"https://api.github.com/repos/square/retrofit/issues/comments/412571692","html_url":"https://github.com/square/retrofit/issues/2851#issuecomment-412571692","issue_url":"https://api.github.com/repos/square/retrofit/issues/2851","id":412571692,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjU3MTY5Mg==","user":{"login":"JakeWharton","id":66577,"node_id":"MDQ6VXNlcjY2NTc3","avatar_url":"https://avatars0.githubusercontent.com/u/66577?v=4","gravatar_id":"","url":"https://api.github.com/users/JakeWharton","html_url":"https://github.com/JakeWharton","followers_url":"https://api.github.com/users/JakeWharton/followers","following_url":"https://api.github.com/users/JakeWharton/following{/other_user}","gists_url":"https://api.github.com/users/JakeWharton/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeWharton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeWharton/subscriptions","organizations_url":"https://api.github.com/users/JakeWharton/orgs","repos_url":"https://api.github.com/users/JakeWharton/repos","events_url":"https://api.github.com/users/JakeWharton/events{/privacy}","received_events_url":"https://api.github.com/users/JakeWharton/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T16:06:06Z","updated_at":"2018-08-13T16:06:06Z","author_association":"COLLABORATOR","body":"A feature request for Gson perhaps in some extras artifact (since it doesn't depend on Guava). Retrofit doesn't participate in the configuration of your chosen serializer. I think your immediate course of action is to write the 10-or-so lines of code to create the `TypeAdapterFactory` for Guava's `Optional<T>` for Gson yourself. Whether you choose to pursue publicizing that elsewhere or trying to land it into Gson (I am also a Gson committer but we're not eager to add new things) is up to you.\r\n\r\nClosing since no action for Retrofit to take."}}
{"actor":{"display_login":"JakeWharton"}}