{"action":"closed","issue":{"url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/issues/509","labels_url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/issues/509/labels{/name}","comments_url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/issues/509/comments","events_url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/issues/509/events","html_url":"https://github.com/chrsmithdemos/google-api-java-client/issues/509","id":59552500,"number":509,"title":"Can't parse enum - ClassInfo does not stores names for enums","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/chrsmithdemos/google-api-java-client/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-02T21:19:23Z","updated_at":"2015-03-02T21:19:23Z","closed_at":"2015-03-02T21:19:23Z","body":"```\nHello. I'm using version 1.9.0-beta in Java SE 6.\n\nI'm creating an object to hold the result of a Maps API response, that right \nnow holds only status, which I model as an enum:\n\npublic enum Status{\n    OK,\n    ZERO_RESULTS,\n    OVER_QUERY_LIMIT,\n    REQUEST_DENIED,\n    INVALID_REQUEST;\n}\n\npublic class Response{\n    @Key private Status status;\n    public Status getStatus{ return status; }\n}\n\nWhen I parse the JSON response, it fails with the following stack trace:\n\njava.lang.NullPointerException\n\tat com.google.api.client.util.Data.parsePrimitiveValue(Data.java:446)\n\tat com.google.api.client.json.JsonParser.parseValue(JsonParser.java:575)\n\tat com.google.api.client.json.JsonParser.parse(JsonParser.java:310)\n\tat com.google.api.client.json.JsonParser.parseValue(JsonParser.java:516)\n\tat com.google.api.client.json.JsonParser.parse(JsonParser.java:253)\n\tat com.google.api.client.json.JsonParser.parseAndClose(JsonParser.java:146)\n\tat com.google.api.client.http.json.JsonHttpParser.parse(JsonHttpParser.java:87)\n\tat com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:487)\n...\n\nThe problem seems to be that ClassInfo can't populate the name table for an \nenum. The following test reproduces it:\n\n    enum Testing\n    {\n        OK,\n        FAIL;\n    }\n\n    public static void main(\n        final String[] args )\n    {\n        final ClassInfo classInfo = ClassInfo.of( Testing.class );\n        //classInfo.names and classInfo.nameToFieldInfoMap are empty\n        final FieldInfo info = classInfo.getFieldInfo( \"OK\" );\n        //info is null\n    }\n\nI'm not sure that I understood the root cause correctly, but shouldn't the Key \nannotation support enums? How would it handle when I want a different enum name \nfrom the one returned by the service, eg., if I wanted my enums to be\n\npublic enum Status{\n    OK,\n    ZERO,\n    OVER_LIMIT,\n    DENIED,\n    INVALID;\n}\n\nThanks for your attention, and I'm available to supply more details if needed.\n\nBruno Kim (brunokim dott mc att google's mail)\n```\n\nOriginal issue reported on code.google.com by `brunokim...@gmail.com` on 6 Jun 2012 at 5:57"}}