{"action":"created","issue":{"url":"https://api.github.com/repos/frankiesardo/auto-parcel/issues/22","labels_url":"https://api.github.com/repos/frankiesardo/auto-parcel/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/frankiesardo/auto-parcel/issues/22/comments","events_url":"https://api.github.com/repos/frankiesardo/auto-parcel/issues/22/events","html_url":"https://github.com/frankiesardo/auto-parcel/issues/22","id":72166230,"number":22,"title":"Enforce implementation of Parcelable","user":{"login":"JakeWharton","id":66577,"avatar_url":"https://avatars.githubusercontent.com/u/66577?v=3","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-30T13:44:13Z","updated_at":"2015-04-30T14:54:14Z","closed_at":null,"body":"We occasionally forget to include `implements Parcelable` on our declarations which ends up failing at runtime. The processor should enforce that all classes annotated with `@AutoParcel` indeed include this declaration (either directly or from a base class) thus moving this to a compile-time validation.\r\n\r\nI believe you can look at how `@AutoService` does verification and copy/paste most or all of its logic."},"comment":{"url":"https://api.github.com/repos/frankiesardo/auto-parcel/issues/comments/97827303","html_url":"https://github.com/frankiesardo/auto-parcel/issues/22#issuecomment-97827303","issue_url":"https://api.github.com/repos/frankiesardo/auto-parcel/issues/22","id":97827303,"user":{"login":"artem-zinnatullin","id":967132,"avatar_url":"https://avatars.githubusercontent.com/u/967132?v=3","gravatar_id":"","url":"https://api.github.com/users/artem-zinnatullin","html_url":"https://github.com/artem-zinnatullin","followers_url":"https://api.github.com/users/artem-zinnatullin/followers","following_url":"https://api.github.com/users/artem-zinnatullin/following{/other_user}","gists_url":"https://api.github.com/users/artem-zinnatullin/gists{/gist_id}","starred_url":"https://api.github.com/users/artem-zinnatullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artem-zinnatullin/subscriptions","organizations_url":"https://api.github.com/users/artem-zinnatullin/orgs","repos_url":"https://api.github.com/users/artem-zinnatullin/repos","events_url":"https://api.github.com/users/artem-zinnatullin/events{/privacy}","received_events_url":"https://api.github.com/users/artem-zinnatullin/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T14:54:14Z","updated_at":"2015-04-30T14:54:14Z","body":"That's sad :(\r\n\r\nGood news: it's very easy to add this check.\r\n\r\nFrom my annotation processor:\r\n\r\n```java\r\n/**\r\n * Checks whether TypeElement directly implements required interface\r\n *\r\n * @param typeElement  type element to check\r\n * @param interfaceFQN fully qualified name of interface \"package.name.InterfaceName\"\r\n * @return true if TypeElement implements required interface, false otherwise\r\n*/\r\npublic static boolean directlyImplementsInterface(TypeElement typeElement, String interfaceFQN) {\r\n  for (TypeMirror interfaceTypeMirror : typeElement.getInterfaces()) {\r\n      if (interfaceTypeMirror.toString().equals(interfaceFQN)) {\r\n          return true;\r\n      }\r\n   }\r\n\r\n   return false;\r\n}\r\n```\r\n\r\nIf you need to check that some of parent classes implements required interface, you can recursively check all enclosing classes, [but](https://github.com/google/auto/tree/master/value#restrictions-and-non-features):\r\n> One @AutoValue class may not extend another. As explained in Effective Java, inheritance of value types simply doesn't work.\r\n\r\nSo this piece of code should be enough, @frankiesardo I can prepare PR for that if you don't mind"}}