{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/buck/issues/1829","repository_url":"https://api.github.com/repos/facebook/buck","labels_url":"https://api.github.com/repos/facebook/buck/issues/1829/labels{/name}","comments_url":"https://api.github.com/repos/facebook/buck/issues/1829/comments","events_url":"https://api.github.com/repos/facebook/buck/issues/1829/events","html_url":"https://github.com/facebook/buck/issues/1829","id":310599640,"number":1829,"title":"Android KAPT in-process compilation class loader conflict","user":{"login":"eggman87","id":2635532,"avatar_url":"https://avatars1.githubusercontent.com/u/2635532?v=4","gravatar_id":"","url":"https://api.github.com/users/eggman87","html_url":"https://github.com/eggman87","followers_url":"https://api.github.com/users/eggman87/followers","following_url":"https://api.github.com/users/eggman87/following{/other_user}","gists_url":"https://api.github.com/users/eggman87/gists{/gist_id}","starred_url":"https://api.github.com/users/eggman87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggman87/subscriptions","organizations_url":"https://api.github.com/users/eggman87/orgs","repos_url":"https://api.github.com/users/eggman87/repos","events_url":"https://api.github.com/users/eggman87/events{/privacy}","received_events_url":"https://api.github.com/users/eggman87/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-02T20:27:14Z","updated_at":"2018-04-10T20:50:14Z","closed_at":"2018-04-10T20:50:14Z","author_association":"NONE","body":"While testing new KAPT support in buck (alongside [okbuck](https://github.com/uber/okbuck)), I came across a issue that surfaced due to my Android project using Butterknife. \r\n\r\nWhile running a build, a exception happens during kotlinc:  \r\n```\r\nerror: [kapt] An exception occurred: java.lang.AssertionError: java.lang.ClassCastException: com.sun.tools.javac.api.JavacTrees cannot be cast to com.sun.source.util.Trees\r\n    at com.sun.source.util.Trees.getJavacTrees(Trees.java:84)\r\n    at com.sun.source.util.Trees.instance(Trees.java:73)\r\n    at butterknife.compiler.ButterKnifeProcessor.init(ButterKnifeProcessor.java:124)\r\n```\r\n\r\nAfter some research, it appears this is due to a classloader conflict when running kotlinc \"in-process\". The same issue actually happened in the kotlin gradle plugin ([issue link](https://youtrack.jetbrains.com/issue/KT-20233#comment=27-2788056)) and was fixed by the kotlin team in [this commit](https://github.com/JetBrains/kotlin/commit/a1939c093c8c87f7f0c5e899c2a8e6e40448d8b0). \r\n\r\nButterknife internally has a dependency on the JDK tools jar, which is where the classes in conflict are coming from. \r\n`compileOnly files(org.gradle.internal.jvm.Jvm.current().getToolsJar())`\r\n\r\nProject Setup:\r\n- mixed java/kotlin android project. \r\n- used local builds of buck and okbuck with the latest kapt support. \r\n\r\nGoing to investigate further and see if I can help come up with a fix, but I am pretty green with Buck/OkBuck and was just investigating usage on our Android project now that kapt is officially supported. Any direction or guidance will be much appreciated. \r\n\r\n**Note:** there is a sample project that demonstrated the issue with gradle located at https://github.com/damianw/KaptInProcessBug I am going to create a sample that uses okbuck and update this issue once it is on github. "},"comment":{"url":"https://api.github.com/repos/facebook/buck/issues/comments/380242138","html_url":"https://github.com/facebook/buck/issues/1829#issuecomment-380242138","issue_url":"https://api.github.com/repos/facebook/buck/issues/1829","id":380242138,"user":{"login":"bobyangyf","id":10293755,"avatar_url":"https://avatars3.githubusercontent.com/u/10293755?v=4","gravatar_id":"","url":"https://api.github.com/users/bobyangyf","html_url":"https://github.com/bobyangyf","followers_url":"https://api.github.com/users/bobyangyf/followers","following_url":"https://api.github.com/users/bobyangyf/following{/other_user}","gists_url":"https://api.github.com/users/bobyangyf/gists{/gist_id}","starred_url":"https://api.github.com/users/bobyangyf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobyangyf/subscriptions","organizations_url":"https://api.github.com/users/bobyangyf/orgs","repos_url":"https://api.github.com/users/bobyangyf/repos","events_url":"https://api.github.com/users/bobyangyf/events{/privacy}","received_events_url":"https://api.github.com/users/bobyangyf/received_events","type":"User","site_admin":false},"created_at":"2018-04-10T20:50:14Z","updated_at":"2018-04-10T20:50:14Z","author_association":"CONTRIBUTOR","body":"We do not encourage doing this in process.\r\nThis really should be done out of process, to avoid complications."}}
{"actor":{"display_login":"bobyangyf"}}