{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/squidb/issues/244","repository_url":"https://api.github.com/repos/yahoo/squidb","labels_url":"https://api.github.com/repos/yahoo/squidb/issues/244/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/squidb/issues/244/comments","events_url":"https://api.github.com/repos/yahoo/squidb/issues/244/events","html_url":"https://github.com/yahoo/squidb/pull/244","id":190141858,"number":244,"title":"Better codegen error logging","user":{"login":"sbosley","id":622224,"avatar_url":"https://avatars.githubusercontent.com/u/622224?v=3","gravatar_id":"","url":"https://api.github.com/users/sbosley","html_url":"https://github.com/sbosley","followers_url":"https://api.github.com/users/sbosley/followers","following_url":"https://api.github.com/users/sbosley/following{/other_user}","gists_url":"https://api.github.com/users/sbosley/gists{/gist_id}","starred_url":"https://api.github.com/users/sbosley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbosley/subscriptions","organizations_url":"https://api.github.com/users/sbosley/orgs","repos_url":"https://api.github.com/users/sbosley/repos","events_url":"https://api.github.com/users/sbosley/events{/privacy}","received_events_url":"https://api.github.com/users/sbosley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-17T19:33:49Z","updated_at":"2016-11-21T16:40:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yahoo/squidb/pulls/244","html_url":"https://github.com/yahoo/squidb/pull/244","diff_url":"https://github.com/yahoo/squidb/pull/244.diff","patch_url":"https://github.com/yahoo/squidb/pull/244.patch"},"body":"Introduces a new API for logging errors during code generation that helps us work around the \"cannot find symbol\" errors we see when using APTs built-in error logging.\r\n\r\nThis solution is kind of a hack but it works way, way better than what we're currently seeing. A problem we often see is that when logging an error using APTs Messager with Kind.ERROR, this error will fail the current round of annotation processing without making the compiler aware of any of the generated code. This leads to many, many \"cannot find symbol <generated model>\" errors, *even though* the class was in fact generated. Those errors mask the real error, making the root problem difficult to find and fix without sorting through a giant error log.\r\n\r\nThis PR leverages a second annotation processor to defer error logging to subsequent rounds, after model classes have already been generated. By saving some error state to the model spec (`modelSpec.logError()`), we can write an annotation to the generated model class containing info about the error we want to log. These annotations are then picked up in a subsequent round of annotation processing by ErrorLoggingProcessor -- but since they're inside the generated model class, the compiler is forced to know about the generated model class in order to process them, eliminating the \"cannot find symbol\" errors. The ErrorLoggingProcessor then parses the annotations to log the relevant errors. Note also that the metadata written to this error annotation contains enough info for the ErrorLoggingProcessor to actually look up the original offending element, so we can still link the error back to its actual cause.\r\n\r\nThis approach seems to work much better than using Messager in all my testing, but in case it causes problems, it's disableable using an option. I think it'll be a useful API going forward for all kinds of additional validation in the code generation step; most immediately I can push up a branch that fixes #243 after this is in."},"comment":{"url":"https://api.github.com/repos/yahoo/squidb/issues/comments/261992699","html_url":"https://github.com/yahoo/squidb/pull/244#issuecomment-261992699","issue_url":"https://api.github.com/repos/yahoo/squidb/issues/244","id":261992699,"user":{"login":"sbosley","id":622224,"avatar_url":"https://avatars.githubusercontent.com/u/622224?v=3","gravatar_id":"","url":"https://api.github.com/users/sbosley","html_url":"https://github.com/sbosley","followers_url":"https://api.github.com/users/sbosley/followers","following_url":"https://api.github.com/users/sbosley/following{/other_user}","gists_url":"https://api.github.com/users/sbosley/gists{/gist_id}","starred_url":"https://api.github.com/users/sbosley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbosley/subscriptions","organizations_url":"https://api.github.com/users/sbosley/orgs","repos_url":"https://api.github.com/users/sbosley/repos","events_url":"https://api.github.com/users/sbosley/events{/privacy}","received_events_url":"https://api.github.com/users/sbosley/received_events","type":"User","site_admin":false},"created_at":"2016-11-21T16:40:46Z","updated_at":"2016-11-21T16:40:46Z","body":"Travis emulators are still misbehaving, but I ran all the tests locally and all is green, so this should be good to go."}}
{"actor":{"display_login":"sbosley"}}