{"action":"created","comment":{"url":"https://api.github.com/repos/jdbi/jdbi/pulls/comments/178673850","pull_request_review_id":108770192,"id":178673850,"diff_hunk":"@@ -18,29 +18,55 @@\n import java.lang.invoke.MethodHandle;\n import java.lang.invoke.MethodHandles;\n import java.lang.reflect.Constructor;\n+import java.lang.reflect.InvocationTargetException;\n import java.lang.reflect.Method;\n import java.util.Map;\n import java.util.WeakHashMap;\n \n import org.jdbi.v3.core.extension.HandleSupplier;\n \n class DefaultMethodHandler implements Handler {\n+    // MethodHandles.privateLookupIn(Class, Lookup) was added in JDK 9.\n+    // JDK 9 allows us to unreflectSpecial() on an interface default method, where JDK 8 did not.\n+    private static final Method PRIVATE_LOOKUP_IN = privateLookupIn();\n+\n+    private static Method privateLookupIn() {\n+        try {\n+            return MethodHandles.class.getMethod(\"privateLookupIn\", Class.class, MethodHandles.Lookup.class);\n+        } catch (NoSuchMethodException e) {\n+            // Method was added in JDK 9\n+            return null;\n+        }\n+    }\n+\n     private static final Map<Class<?>, MethodHandles.Lookup> privateLookups = synchronizedMap(new WeakHashMap<>());\n \n     private static MethodHandles.Lookup lookupFor(Class<?> clazz) {\n-        return privateLookups.computeIfAbsent(clazz, type -> {\n+        if (PRIVATE_LOOKUP_IN != null) {\n             try {\n-                // TERRIBLE, HORRIBLE, NO GOOD, VERY BAD HACK\n-                // Courtesy of:\n-                // https://rmannibucau.wordpress.com/2014/03/27/java-8-default-interface-methods-and-jdk-dynamic-proxies/\n+                return (MethodHandles.Lookup) PRIVATE_LOOKUP_IN.invoke(null, clazz, MethodHandles.lookup());\n+            } catch (IllegalAccessException | InvocationTargetException e) {\n+                String message = String.format(\n+                        \"Error invoking MethodHandles.privateLookupIn(%s.class, MethodHandles.lookup()) in JDK 9+ runtime\",\n+                        clazz);\n+                throw new RuntimeException(message, e);","path":"sqlobject/src/main/java/org/jdbi/v3/sqlobject/DefaultMethodHandler.java","position":39,"original_position":39,"commit_id":"f251de36a5196c1ad2033865f052d8ac411540d3","original_commit_id":"f251de36a5196c1ad2033865f052d8ac411540d3","user":{"login":"qualidafial","id":38629,"avatar_url":"https://avatars2.githubusercontent.com/u/38629?v=4","gravatar_id":"","url":"https://api.github.com/users/qualidafial","html_url":"https://github.com/qualidafial","followers_url":"https://api.github.com/users/qualidafial/followers","following_url":"https://api.github.com/users/qualidafial/following{/other_user}","gists_url":"https://api.github.com/users/qualidafial/gists{/gist_id}","starred_url":"https://api.github.com/users/qualidafial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qualidafial/subscriptions","organizations_url":"https://api.github.com/users/qualidafial/orgs","repos_url":"https://api.github.com/users/qualidafial/repos","events_url":"https://api.github.com/users/qualidafial/events{/privacy}","received_events_url":"https://api.github.com/users/qualidafial/received_events","type":"User","site_admin":false},"body":"Should we attempt to fall through to the JDK 8 hack here?","created_at":"2018-04-02T23:02:45Z","updated_at":"2018-04-02T23:02:45Z","html_url":"https://github.com/jdbi/jdbi/pull/1066#discussion_r178673850","pull_request_url":"https://api.github.com/repos/jdbi/jdbi/pulls/1066","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/jdbi/jdbi/pulls/comments/178673850"},"html":{"href":"https://github.com/jdbi/jdbi/pull/1066#discussion_r178673850"},"pull_request":{"href":"https://api.github.com/repos/jdbi/jdbi/pulls/1066"}}},"pull_request":{"url":"https://api.github.com/repos/jdbi/jdbi/pulls/1066","id":178952602,"html_url":"https://github.com/jdbi/jdbi/pull/1066","diff_url":"https://github.com/jdbi/jdbi/pull/1066.diff","patch_url":"https://github.com/jdbi/jdbi/pull/1066.patch","issue_url":"https://api.github.com/repos/jdbi/jdbi/issues/1066","number":1066,"state":"open","locked":false,"title":"Support SQL Object default methods in JDK9+","user":{"login":"qualidafial","id":38629,"avatar_url":"https://avatars2.githubusercontent.com/u/38629?v=4","gravatar_id":"","url":"https://api.github.com/users/qualidafial","html_url":"https://github.com/qualidafial","followers_url":"https://api.github.com/users/qualidafial/followers","following_url":"https://api.github.com/users/qualidafial/following{/other_user}","gists_url":"https://api.github.com/users/qualidafial/gists{/gist_id}","starred_url":"https://api.github.com/users/qualidafial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qualidafial/subscriptions","organizations_url":"https://api.github.com/users/qualidafial/orgs","repos_url":"https://api.github.com/users/qualidafial/repos","events_url":"https://api.github.com/users/qualidafial/events{/privacy}","received_events_url":"https://api.github.com/users/qualidafial/received_events","type":"User","site_admin":false},"body":"Fixes #497.\r\n\r\n@keithbranton can you please confirm this fixes SQL Object default methods in JDK 9?","created_at":"2018-04-02T22:50:59Z","updated_at":"2018-04-02T23:02:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80a4a995b32e8229a41be4aeddc7268388d5f4fe","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":278717830,"url":"https://api.github.com/repos/jdbi/jdbi/labels/improvement","name":"improvement","color":"5319e7","default":false}],"milestone":{"url":"https://api.github.com/repos/jdbi/jdbi/milestones/6","html_url":"https://github.com/jdbi/jdbi/milestone/6","labels_url":"https://api.github.com/repos/jdbi/jdbi/milestones/6/labels","id":2510820,"number":6,"title":"jdk9","description":"Make jdbi3 great again!","creator":{"login":"stevenschlansker","id":129097,"avatar_url":"https://avatars0.githubusercontent.com/u/129097?v=4","gravatar_id":"","url":"https://api.github.com/users/stevenschlansker","html_url":"https://github.com/stevenschlansker","followers_url":"https://api.github.com/users/stevenschlansker/followers","following_url":"https://api.github.com/users/stevenschlansker/following{/other_user}","gists_url":"https://api.github.com/users/stevenschlansker/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenschlansker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenschlansker/subscriptions","organizations_url":"https://api.github.com/users/stevenschlansker/orgs","repos_url":"https://api.github.com/users/stevenschlansker/repos","events_url":"https://api.github.com/users/stevenschlansker/events{/privacy}","received_events_url":"https://api.github.com/users/stevenschlansker/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":1,"state":"open","created_at":"2017-05-09T17:58:51Z","updated_at":"2018-04-02T22:50:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/jdbi/jdbi/pulls/1066/commits","review_comments_url":"https://api.github.com/repos/jdbi/jdbi/pulls/1066/comments","review_comment_url":"https://api.github.com/repos/jdbi/jdbi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jdbi/jdbi/issues/1066/comments","statuses_url":"https://api.github.com/repos/jdbi/jdbi/statuses/f251de36a5196c1ad2033865f052d8ac411540d3","head":{"label":"jdbi:sql-object-default-methods-jdk9","ref":"sql-object-default-methods-jdk9","sha":"f251de36a5196c1ad2033865f052d8ac411540d3","user":{"login":"jdbi","id":9668860,"avatar_url":"https://avatars0.githubusercontent.com/u/9668860?v=4","gravatar_id":"","url":"https://api.github.com/users/jdbi","html_url":"https://github.com/jdbi","followers_url":"https://api.github.com/users/jdbi/followers","following_url":"https://api.github.com/users/jdbi/following{/other_user}","gists_url":"https://api.github.com/users/jdbi/gists{/gist_id}","starred_url":"https://api.github.com/users/jdbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdbi/subscriptions","organizations_url":"https://api.github.com/users/jdbi/orgs","repos_url":"https://api.github.com/users/jdbi/repos","events_url":"https://api.github.com/users/jdbi/events{/privacy}","received_events_url":"https://api.github.com/users/jdbi/received_events","type":"Organization","site_admin":false},"repo":{"id":229738,"name":"jdbi","full_name":"jdbi/jdbi","owner":{"login":"jdbi","id":9668860,"avatar_url":"https://avatars0.githubusercontent.com/u/9668860?v=4","gravatar_id":"","url":"https://api.github.com/users/jdbi","html_url":"https://github.com/jdbi","followers_url":"https://api.github.com/users/jdbi/followers","following_url":"https://api.github.com/users/jdbi/following{/other_user}","gists_url":"https://api.github.com/users/jdbi/gists{/gist_id}","starred_url":"https://api.github.com/users/jdbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdbi/subscriptions","organizations_url":"https://api.github.com/users/jdbi/orgs","repos_url":"https://api.github.com/users/jdbi/repos","events_url":"https://api.github.com/users/jdbi/events{/privacy}","received_events_url":"https://api.github.com/users/jdbi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jdbi/jdbi","description":"jDBI is designed to provide convenient tabular data access in Java(tm). It uses the Java collections framework for query results, provides a convenient means of externalizing sql statements, and provides named parameter support for any database being used.","fork":false,"url":"https://api.github.com/repos/jdbi/jdbi","forks_url":"https://api.github.com/repos/jdbi/jdbi/forks","keys_url":"https://api.github.com/repos/jdbi/jdbi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdbi/jdbi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdbi/jdbi/teams","hooks_url":"https://api.github.com/repos/jdbi/jdbi/hooks","issue_events_url":"https://api.github.com/repos/jdbi/jdbi/issues/events{/number}","events_url":"https://api.github.com/repos/jdbi/jdbi/events","assignees_url":"https://api.github.com/repos/jdbi/jdbi/assignees{/user}","branches_url":"https://api.github.com/repos/jdbi/jdbi/branches{/branch}","tags_url":"https://api.github.com/repos/jdbi/jdbi/tags","blobs_url":"https://api.github.com/repos/jdbi/jdbi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdbi/jdbi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdbi/jdbi/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdbi/jdbi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdbi/jdbi/statuses/{sha}","languages_url":"https://api.github.com/repos/jdbi/jdbi/languages","stargazers_url":"https://api.github.com/repos/jdbi/jdbi/stargazers","contributors_url":"https://api.github.com/repos/jdbi/jdbi/contributors","subscribers_url":"https://api.github.com/repos/jdbi/jdbi/subscribers","subscription_url":"https://api.github.com/repos/jdbi/jdbi/subscription","commits_url":"https://api.github.com/repos/jdbi/jdbi/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdbi/jdbi/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdbi/jdbi/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdbi/jdbi/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdbi/jdbi/contents/{+path}","compare_url":"https://api.github.com/repos/jdbi/jdbi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdbi/jdbi/merges","archive_url":"https://api.github.com/repos/jdbi/jdbi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdbi/jdbi/downloads","issues_url":"https://api.github.com/repos/jdbi/jdbi/issues{/number}","pulls_url":"https://api.github.com/repos/jdbi/jdbi/pulls{/number}","milestones_url":"https://api.github.com/repos/jdbi/jdbi/milestones{/number}","notifications_url":"https://api.github.com/repos/jdbi/jdbi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdbi/jdbi/labels{/name}","releases_url":"https://api.github.com/repos/jdbi/jdbi/releases{/id}","deployments_url":"https://api.github.com/repos/jdbi/jdbi/deployments","created_at":"2009-06-17T16:36:36Z","updated_at":"2018-04-02T20:07:21Z","pushed_at":"2018-04-02T22:51:00Z","git_url":"git://github.com/jdbi/jdbi.git","ssh_url":"git@github.com:jdbi/jdbi.git","clone_url":"https://github.com/jdbi/jdbi.git","svn_url":"https://github.com/jdbi/jdbi","homepage":"http://jdbi.org/","size":16672,"stargazers_count":974,"watchers_count":974,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":201,"mirror_url":null,"archived":false,"open_issues_count":55,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":201,"open_issues":55,"watchers":974,"default_branch":"master"}},"base":{"label":"jdbi:master","ref":"master","sha":"fe097743f63cfc7218ffc30f143a2d23fec186cf","user":{"login":"jdbi","id":9668860,"avatar_url":"https://avatars0.githubusercontent.com/u/9668860?v=4","gravatar_id":"","url":"https://api.github.com/users/jdbi","html_url":"https://github.com/jdbi","followers_url":"https://api.github.com/users/jdbi/followers","following_url":"https://api.github.com/users/jdbi/following{/other_user}","gists_url":"https://api.github.com/users/jdbi/gists{/gist_id}","starred_url":"https://api.github.com/users/jdbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdbi/subscriptions","organizations_url":"https://api.github.com/users/jdbi/orgs","repos_url":"https://api.github.com/users/jdbi/repos","events_url":"https://api.github.com/users/jdbi/events{/privacy}","received_events_url":"https://api.github.com/users/jdbi/received_events","type":"Organization","site_admin":false},"repo":{"id":229738,"name":"jdbi","full_name":"jdbi/jdbi","owner":{"login":"jdbi","id":9668860,"avatar_url":"https://avatars0.githubusercontent.com/u/9668860?v=4","gravatar_id":"","url":"https://api.github.com/users/jdbi","html_url":"https://github.com/jdbi","followers_url":"https://api.github.com/users/jdbi/followers","following_url":"https://api.github.com/users/jdbi/following{/other_user}","gists_url":"https://api.github.com/users/jdbi/gists{/gist_id}","starred_url":"https://api.github.com/users/jdbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdbi/subscriptions","organizations_url":"https://api.github.com/users/jdbi/orgs","repos_url":"https://api.github.com/users/jdbi/repos","events_url":"https://api.github.com/users/jdbi/events{/privacy}","received_events_url":"https://api.github.com/users/jdbi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jdbi/jdbi","description":"jDBI is designed to provide convenient tabular data access in Java(tm). It uses the Java collections framework for query results, provides a convenient means of externalizing sql statements, and provides named parameter support for any database being used.","fork":false,"url":"https://api.github.com/repos/jdbi/jdbi","forks_url":"https://api.github.com/repos/jdbi/jdbi/forks","keys_url":"https://api.github.com/repos/jdbi/jdbi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdbi/jdbi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdbi/jdbi/teams","hooks_url":"https://api.github.com/repos/jdbi/jdbi/hooks","issue_events_url":"https://api.github.com/repos/jdbi/jdbi/issues/events{/number}","events_url":"https://api.github.com/repos/jdbi/jdbi/events","assignees_url":"https://api.github.com/repos/jdbi/jdbi/assignees{/user}","branches_url":"https://api.github.com/repos/jdbi/jdbi/branches{/branch}","tags_url":"https://api.github.com/repos/jdbi/jdbi/tags","blobs_url":"https://api.github.com/repos/jdbi/jdbi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdbi/jdbi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdbi/jdbi/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdbi/jdbi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdbi/jdbi/statuses/{sha}","languages_url":"https://api.github.com/repos/jdbi/jdbi/languages","stargazers_url":"https://api.github.com/repos/jdbi/jdbi/stargazers","contributors_url":"https://api.github.com/repos/jdbi/jdbi/contributors","subscribers_url":"https://api.github.com/repos/jdbi/jdbi/subscribers","subscription_url":"https://api.github.com/repos/jdbi/jdbi/subscription","commits_url":"https://api.github.com/repos/jdbi/jdbi/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdbi/jdbi/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdbi/jdbi/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdbi/jdbi/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdbi/jdbi/contents/{+path}","compare_url":"https://api.github.com/repos/jdbi/jdbi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdbi/jdbi/merges","archive_url":"https://api.github.com/repos/jdbi/jdbi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdbi/jdbi/downloads","issues_url":"https://api.github.com/repos/jdbi/jdbi/issues{/number}","pulls_url":"https://api.github.com/repos/jdbi/jdbi/pulls{/number}","milestones_url":"https://api.github.com/repos/jdbi/jdbi/milestones{/number}","notifications_url":"https://api.github.com/repos/jdbi/jdbi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdbi/jdbi/labels{/name}","releases_url":"https://api.github.com/repos/jdbi/jdbi/releases{/id}","deployments_url":"https://api.github.com/repos/jdbi/jdbi/deployments","created_at":"2009-06-17T16:36:36Z","updated_at":"2018-04-02T20:07:21Z","pushed_at":"2018-04-02T22:51:00Z","git_url":"git://github.com/jdbi/jdbi.git","ssh_url":"git@github.com:jdbi/jdbi.git","clone_url":"https://github.com/jdbi/jdbi.git","svn_url":"https://github.com/jdbi/jdbi","homepage":"http://jdbi.org/","size":16672,"stargazers_count":974,"watchers_count":974,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":201,"mirror_url":null,"archived":false,"open_issues_count":55,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":201,"open_issues":55,"watchers":974,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jdbi/jdbi/pulls/1066"},"html":{"href":"https://github.com/jdbi/jdbi/pull/1066"},"issue":{"href":"https://api.github.com/repos/jdbi/jdbi/issues/1066"},"comments":{"href":"https://api.github.com/repos/jdbi/jdbi/issues/1066/comments"},"review_comments":{"href":"https://api.github.com/repos/jdbi/jdbi/pulls/1066/comments"},"review_comment":{"href":"https://api.github.com/repos/jdbi/jdbi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jdbi/jdbi/pulls/1066/commits"},"statuses":{"href":"https://api.github.com/repos/jdbi/jdbi/statuses/f251de36a5196c1ad2033865f052d8ac411540d3"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"qualidafial"}}