{"action":"created","comment":{"url":"https://api.github.com/repos/livecode/livecode/pulls/comments/79779848","id":79779848,"diff_hunk":"@@ -0,0 +1,234 @@\n+/* Copyright (C) 2003-2016 LiveCode Ltd.\n+\n+This file is part of LiveCode.\n+\n+LiveCode is free software; you can redistribute it and/or modify it under\n+the terms of the GNU General Public License v3 as published by the Free\n+Software Foundation.\n+\n+LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY\n+WARRANTY; without even the implied warranty of MERCHANTABILITY or\n+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\n+for more details.\n+\n+You should have received a copy of the GNU General Public License\n+along with LiveCode.  If not see <http://www.gnu.org/licenses/>.  */\n+\n+#include <foundation.h>\n+#include <foundation-auto.h>\n+\n+#include \"foundation-private.h\"\n+\n+#ifdef TARGET_PLATFORM_MACOS_X\n+#include <JavaVM/jni.h>\n+#elif TARGET_SUBPLATFORM_ANDROID\n+#include <jni.h>\n+extern JNIEnv *MCJavaGetThreadEnv();\n+extern JNIEnv *MCJavaAttachCurrentThread();\n+extern void MCJavaDetachCurrentThread();\n+#endif\n+\n+#if defined(TARGET_PLATFORM_MACOS_X) || defined(TARGET_SUBPLATFORM_ANDROID)\n+#define TARGET_SUPPORTS_JAVA\n+#endif\n+\n+#ifdef TARGET_SUPPORTS_JAVA\n+static JNIEnv *s_env;\n+static JavaVM *s_jvm;\n+#endif\n+\n+bool __MCJavaInitialize()\n+{\n+#ifdef TARGET_PLATFORM_MACOS_X\n+    JavaVMInitArgs vm_args;\n+    vm_args.version = JNI_VERSION_1_6;\n+    JNI_GetDefaultJavaVMInitArgs(&vm_args);\n+\n+    JavaVMOption* options = new JavaVMOption[1];\n+    options[0].optionString = \"-Djava.class.path=/usr/lib/java\";\n+    \n+    vm_args.nOptions = 1;\n+    vm_args.options = options;\n+    vm_args.ignoreUnrecognized = false;\n+    \n+    JNI_CreateJavaVM(&s_jvm, (void **)&s_env, &vm_args);","path":"libfoundation/src/foundation-java.cpp","position":54,"original_position":54,"commit_id":"9971650d33d57c8f2080f07a4b6b276d10554306","original_commit_id":"bc1d171cdfab7af22f18b7d9ab32d1345420bc8d","user":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"body":"I wonder if the best thing to do would be to allow it to fail, and just keep a variable around like `s_java_initialised` so that everything can just return false if it failed","created_at":"2016-09-21T08:11:30Z","updated_at":"2016-09-21T08:11:30Z","html_url":"https://github.com/livecode/livecode/pull/4529#discussion_r79779848","pull_request_url":"https://api.github.com/repos/livecode/livecode/pulls/4529","_links":{"self":{"href":"https://api.github.com/repos/livecode/livecode/pulls/comments/79779848"},"html":{"href":"https://github.com/livecode/livecode/pull/4529#discussion_r79779848"},"pull_request":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4529"}}},"pull_request":{"url":"https://api.github.com/repos/livecode/livecode/pulls/4529","id":85987854,"html_url":"https://github.com/livecode/livecode/pull/4529","diff_url":"https://github.com/livecode/livecode/pull/4529.diff","patch_url":"https://github.com/livecode/livecode/pull/4529.patch","issue_url":"https://api.github.com/repos/livecode/livecode/issues/4529","number":4529,"state":"open","locked":false,"title":"[[ Java FFI ]] LibFoundation and LibScript support for Java FFI","user":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"body":"This could do with some more work and rejigging  - in particular:\r\n- [ ] Initialise JVM on Linux\r\n- [ ] Move various bits of Android foundation code to foundation-java\r\n- [ ] Add support for Java arrays\r\n- [ ] Deal with object refs correctly\r\n- [ ] Do some sort of weak linking so that JVM is only initialised when requested\r\n- [ ] Add tests","created_at":"2016-09-20T14:34:32Z","updated_at":"2016-09-21T08:11:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3abc1d517b59befc8f1ebcc568ac3ca534714de","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/livecode/livecode/milestones/118","html_url":"https://github.com/livecode/livecode/milestones/8.2.0-dp-1","labels_url":"https://api.github.com/repos/livecode/livecode/milestones/118/labels","id":1969211,"number":118,"title":"8.2.0-dp-1","description":null,"creator":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":38,"state":"open","created_at":"2016-08-29T09:35:57Z","updated_at":"2016-09-21T08:02:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/livecode/livecode/pulls/4529/commits","review_comments_url":"https://api.github.com/repos/livecode/livecode/pulls/4529/comments","review_comment_url":"https://api.github.com/repos/livecode/livecode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/livecode/livecode/issues/4529/comments","statuses_url":"https://api.github.com/repos/livecode/livecode/statuses/9971650d33d57c8f2080f07a4b6b276d10554306","head":{"label":"livecodeali:feature-java_ffi_support","ref":"feature-java_ffi_support","sha":"9971650d33d57c8f2080f07a4b6b276d10554306","user":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"repo":{"id":10689153,"name":"livecode","full_name":"livecodeali/livecode","owner":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/livecodeali/livecode","description":"","fork":true,"url":"https://api.github.com/repos/livecodeali/livecode","forks_url":"https://api.github.com/repos/livecodeali/livecode/forks","keys_url":"https://api.github.com/repos/livecodeali/livecode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/livecodeali/livecode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/livecodeali/livecode/teams","hooks_url":"https://api.github.com/repos/livecodeali/livecode/hooks","issue_events_url":"https://api.github.com/repos/livecodeali/livecode/issues/events{/number}","events_url":"https://api.github.com/repos/livecodeali/livecode/events","assignees_url":"https://api.github.com/repos/livecodeali/livecode/assignees{/user}","branches_url":"https://api.github.com/repos/livecodeali/livecode/branches{/branch}","tags_url":"https://api.github.com/repos/livecodeali/livecode/tags","blobs_url":"https://api.github.com/repos/livecodeali/livecode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/livecodeali/livecode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/livecodeali/livecode/git/refs{/sha}","trees_url":"https://api.github.com/repos/livecodeali/livecode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/livecodeali/livecode/statuses/{sha}","languages_url":"https://api.github.com/repos/livecodeali/livecode/languages","stargazers_url":"https://api.github.com/repos/livecodeali/livecode/stargazers","contributors_url":"https://api.github.com/repos/livecodeali/livecode/contributors","subscribers_url":"https://api.github.com/repos/livecodeali/livecode/subscribers","subscription_url":"https://api.github.com/repos/livecodeali/livecode/subscription","commits_url":"https://api.github.com/repos/livecodeali/livecode/commits{/sha}","git_commits_url":"https://api.github.com/repos/livecodeali/livecode/git/commits{/sha}","comments_url":"https://api.github.com/repos/livecodeali/livecode/comments{/number}","issue_comment_url":"https://api.github.com/repos/livecodeali/livecode/issues/comments{/number}","contents_url":"https://api.github.com/repos/livecodeali/livecode/contents/{+path}","compare_url":"https://api.github.com/repos/livecodeali/livecode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/livecodeali/livecode/merges","archive_url":"https://api.github.com/repos/livecodeali/livecode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/livecodeali/livecode/downloads","issues_url":"https://api.github.com/repos/livecodeali/livecode/issues{/number}","pulls_url":"https://api.github.com/repos/livecodeali/livecode/pulls{/number}","milestones_url":"https://api.github.com/repos/livecodeali/livecode/milestones{/number}","notifications_url":"https://api.github.com/repos/livecodeali/livecode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/livecodeali/livecode/labels{/name}","releases_url":"https://api.github.com/repos/livecodeali/livecode/releases{/id}","deployments_url":"https://api.github.com/repos/livecodeali/livecode/deployments","created_at":"2013-06-14T13:10:19Z","updated_at":"2015-05-23T15:45:50Z","pushed_at":"2016-09-20T15:21:27Z","git_url":"git://github.com/livecodeali/livecode.git","ssh_url":"git@github.com:livecodeali/livecode.git","clone_url":"https://github.com/livecodeali/livecode.git","svn_url":"https://github.com/livecodeali/livecode","homepage":null,"size":121320,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"livecode:develop","ref":"develop","sha":"e5c264950e46af60329cc5fe9a66b8e09c2e3520","user":{"login":"livecode","id":3985749,"avatar_url":"https://avatars.githubusercontent.com/u/3985749?v=3","gravatar_id":"","url":"https://api.github.com/users/livecode","html_url":"https://github.com/livecode","followers_url":"https://api.github.com/users/livecode/followers","following_url":"https://api.github.com/users/livecode/following{/other_user}","gists_url":"https://api.github.com/users/livecode/gists{/gist_id}","starred_url":"https://api.github.com/users/livecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecode/subscriptions","organizations_url":"https://api.github.com/users/livecode/orgs","repos_url":"https://api.github.com/users/livecode/repos","events_url":"https://api.github.com/users/livecode/events{/privacy}","received_events_url":"https://api.github.com/users/livecode/received_events","type":"Organization","site_admin":false},"repo":{"id":9334445,"name":"livecode","full_name":"livecode/livecode","owner":{"login":"livecode","id":3985749,"avatar_url":"https://avatars.githubusercontent.com/u/3985749?v=3","gravatar_id":"","url":"https://api.github.com/users/livecode","html_url":"https://github.com/livecode","followers_url":"https://api.github.com/users/livecode/followers","following_url":"https://api.github.com/users/livecode/following{/other_user}","gists_url":"https://api.github.com/users/livecode/gists{/gist_id}","starred_url":"https://api.github.com/users/livecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecode/subscriptions","organizations_url":"https://api.github.com/users/livecode/orgs","repos_url":"https://api.github.com/users/livecode/repos","events_url":"https://api.github.com/users/livecode/events{/privacy}","received_events_url":"https://api.github.com/users/livecode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/livecode/livecode","description":"LiveCode cross-platform development environment (engine)","fork":false,"url":"https://api.github.com/repos/livecode/livecode","forks_url":"https://api.github.com/repos/livecode/livecode/forks","keys_url":"https://api.github.com/repos/livecode/livecode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/livecode/livecode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/livecode/livecode/teams","hooks_url":"https://api.github.com/repos/livecode/livecode/hooks","issue_events_url":"https://api.github.com/repos/livecode/livecode/issues/events{/number}","events_url":"https://api.github.com/repos/livecode/livecode/events","assignees_url":"https://api.github.com/repos/livecode/livecode/assignees{/user}","branches_url":"https://api.github.com/repos/livecode/livecode/branches{/branch}","tags_url":"https://api.github.com/repos/livecode/livecode/tags","blobs_url":"https://api.github.com/repos/livecode/livecode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/livecode/livecode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/livecode/livecode/git/refs{/sha}","trees_url":"https://api.github.com/repos/livecode/livecode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/livecode/livecode/statuses/{sha}","languages_url":"https://api.github.com/repos/livecode/livecode/languages","stargazers_url":"https://api.github.com/repos/livecode/livecode/stargazers","contributors_url":"https://api.github.com/repos/livecode/livecode/contributors","subscribers_url":"https://api.github.com/repos/livecode/livecode/subscribers","subscription_url":"https://api.github.com/repos/livecode/livecode/subscription","commits_url":"https://api.github.com/repos/livecode/livecode/commits{/sha}","git_commits_url":"https://api.github.com/repos/livecode/livecode/git/commits{/sha}","comments_url":"https://api.github.com/repos/livecode/livecode/comments{/number}","issue_comment_url":"https://api.github.com/repos/livecode/livecode/issues/comments{/number}","contents_url":"https://api.github.com/repos/livecode/livecode/contents/{+path}","compare_url":"https://api.github.com/repos/livecode/livecode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/livecode/livecode/merges","archive_url":"https://api.github.com/repos/livecode/livecode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/livecode/livecode/downloads","issues_url":"https://api.github.com/repos/livecode/livecode/issues{/number}","pulls_url":"https://api.github.com/repos/livecode/livecode/pulls{/number}","milestones_url":"https://api.github.com/repos/livecode/livecode/milestones{/number}","notifications_url":"https://api.github.com/repos/livecode/livecode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/livecode/livecode/labels{/name}","releases_url":"https://api.github.com/repos/livecode/livecode/releases{/id}","deployments_url":"https://api.github.com/repos/livecode/livecode/deployments","created_at":"2013-04-10T00:15:57Z","updated_at":"2016-09-16T18:05:19Z","pushed_at":"2016-09-21T07:48:33Z","git_url":"git://github.com/livecode/livecode.git","ssh_url":"git@github.com:livecode/livecode.git","clone_url":"https://github.com/livecode/livecode.git","svn_url":"https://github.com/livecode/livecode","homepage":"https://livecode.com/","size":182513,"stargazers_count":143,"watchers_count":143,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":109,"mirror_url":null,"open_issues_count":77,"forks":109,"open_issues":77,"watchers":143,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4529"},"html":{"href":"https://github.com/livecode/livecode/pull/4529"},"issue":{"href":"https://api.github.com/repos/livecode/livecode/issues/4529"},"comments":{"href":"https://api.github.com/repos/livecode/livecode/issues/4529/comments"},"review_comments":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4529/comments"},"review_comment":{"href":"https://api.github.com/repos/livecode/livecode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4529/commits"},"statuses":{"href":"https://api.github.com/repos/livecode/livecode/statuses/9971650d33d57c8f2080f07a4b6b276d10554306"}}}}
{"actor":{"display_login":"livecodeali"}}