{"action":"created","issue":{"url":"https://api.github.com/repos/square/javapoet/issues/253","labels_url":"https://api.github.com/repos/square/javapoet/issues/253/labels{/name}","comments_url":"https://api.github.com/repos/square/javapoet/issues/253/comments","events_url":"https://api.github.com/repos/square/javapoet/issues/253/events","html_url":"https://github.com/square/javapoet/issues/253","id":62570863,"number":253,"title":"How do I add an annotation to an enum value","user":{"login":"inder123","id":1093834,"avatar_url":"https://avatars.githubusercontent.com/u/1093834?v=3","gravatar_id":"","url":"https://api.github.com/users/inder123","html_url":"https://github.com/inder123","followers_url":"https://api.github.com/users/inder123/followers","following_url":"https://api.github.com/users/inder123/following{/other_user}","gists_url":"https://api.github.com/users/inder123/gists{/gist_id}","starred_url":"https://api.github.com/users/inder123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inder123/subscriptions","organizations_url":"https://api.github.com/users/inder123/orgs","repos_url":"https://api.github.com/users/inder123/repos","events_url":"https://api.github.com/users/inder123/events{/privacy}","received_events_url":"https://api.github.com/users/inder123/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-18T02:45:44Z","updated_at":"2015-03-18T03:13:32Z","closed_at":null,"body":"For Json2Java project, I need to define Gson SerializedName annotation on Enum values. How do I do that? I only see addEnumConstant() method "},"comment":{"url":"https://api.github.com/repos/square/javapoet/issues/comments/82712817","html_url":"https://github.com/square/javapoet/issues/253#issuecomment-82712817","issue_url":"https://api.github.com/repos/square/javapoet/issues/253","id":82712817,"user":{"login":"swankjesse","id":133019,"avatar_url":"https://avatars.githubusercontent.com/u/133019?v=3","gravatar_id":"","url":"https://api.github.com/users/swankjesse","html_url":"https://github.com/swankjesse","followers_url":"https://api.github.com/users/swankjesse/followers","following_url":"https://api.github.com/users/swankjesse/following{/other_user}","gists_url":"https://api.github.com/users/swankjesse/gists{/gist_id}","starred_url":"https://api.github.com/users/swankjesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swankjesse/subscriptions","organizations_url":"https://api.github.com/users/swankjesse/orgs","repos_url":"https://api.github.com/users/swankjesse/repos","events_url":"https://api.github.com/users/swankjesse/events{/privacy}","received_events_url":"https://api.github.com/users/swankjesse/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T03:13:31Z","updated_at":"2015-03-18T03:13:31Z","body":"Not currently possible. I think what we probably want is to change it so you can use this overload:\r\n\r\n ```\r\n    public Builder addEnumConstant(String name, TypeSpec typeSpec) {\r\n```\r\n\r\nAnd the typeSpec there can carry annotations that get attached to the enum. The one catch is that right now we forbid annotations on anonymous types; we could just relax that now that we have a use case for it.\r\n\r\nWanna send a pull request? You can copy+paste `TypeSpecTest#enumWithSubclassing` as a starting point!"}}