{"action":"created","issue":{"url":"https://api.github.com/repos/privat/nit/issues/1599","labels_url":"https://api.github.com/repos/privat/nit/issues/1599/labels{/name}","comments_url":"https://api.github.com/repos/privat/nit/issues/1599/comments","events_url":"https://api.github.com/repos/privat/nit/issues/1599/events","html_url":"https://github.com/privat/nit/pull/1599","id":97936005,"number":1599,"title":"jwrapper supports static properties, primitive arrays and generic parameters","user":{"login":"xymus","id":208057,"avatar_url":"https://avatars.githubusercontent.com/u/208057?v=3","gravatar_id":"","url":"https://api.github.com/users/xymus","html_url":"https://github.com/xymus","followers_url":"https://api.github.com/users/xymus/followers","following_url":"https://api.github.com/users/xymus/following{/other_user}","gists_url":"https://api.github.com/users/xymus/gists{/gist_id}","starred_url":"https://api.github.com/users/xymus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xymus/subscriptions","organizations_url":"https://api.github.com/users/xymus/orgs","repos_url":"https://api.github.com/users/xymus/repos","events_url":"https://api.github.com/users/xymus/events{/privacy}","received_events_url":"https://api.github.com/users/xymus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/privat/nit/labels/need_review","name":"need_review","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-29T13:28:36Z","updated_at":"2015-07-29T19:11:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/privat/nit/pulls/1599","html_url":"https://github.com/privat/nit/pull/1599","diff_url":"https://github.com/privat/nit/pull/1599.diff","patch_url":"https://github.com/privat/nit/pull/1599.patch"},"body":"This PR continues the work of #1578 and #1589. It improves jwrapper to support more features of the Java language: static functions and attributes, primitives arrays and generic parameters. The resulting generated wrapper of large Java namespaces is now usable with semi-global compilation!\r\n\r\nMain changes:\r\n\r\n* Wrap static functions and attributes as top-level methods.\r\n\r\n* Generate a primitive array wrapper for each target class. By default, only wrap 1 dimension arrays, it's enough in most cases (see stats at the bottom).\r\n\r\n* Resolve generic parameters and use the closest bound (only the first bound).\r\n\r\n* Add JNI services to each classes.\r\n\r\n* Jwrapper is now good enough to wrap the `java` and `org` namespace of the Java library\r\n  and to use them in semi-global compilation. See the new example `java_api` to see it in action.\r\n\r\n  The _full_ Java generated by this tool and by the FFI pass the basic semantic check of javac,\r\n  but it still raise errors and warnings on illegal access of internal, protected or obsolete entities.\r\n  This may need manual tweaking of the tool to block these cases, that information is not made available by the output of javap.\r\n\r\n  Compiling `java_api` in separate compilation takes about 20 minutes and crashes at the compilation of the generated C code. More investigation is required to find the problem, but I suspect the C file of 132 mo generated by the FFI to manipulate the JNI.\r\n\r\nWhat's to do next:\r\n* Class hierarchy!\r\n* Negative filtering of the target classes in a Jar archive.\r\n* Filtering of methods to avoid obsolete ones? Or simply remove them manually after generation?\r\n* vararg support.\r\n* Revamp the `java` module and low-level types.\r\n\r\n## Some stats on the Android lib example\r\n\r\nDisabled functions before this PR:\r\n* java_api.nit: 1448 / 12805\r\n* android_api.nit: 1075 / 22084\r\n\r\nDisabled functions now:\r\n* java_api.nit: 5 / 14248 # From a multi-dimensional array\r\n* java_api.nit: 29 / 14248 # From a vararg\r\n* android_api.nit: 1 / 23138 # From a multi-dimensional array\r\n* android_api.nit: 21 / 23138 # From a vararg\r\n\r\nAll the unknown multi-dimensional array: (these could be added by hand to the library)\r\n* int[][]\r\n* java.lang.String[][]\r\n* java.lang.annotation.Annotation[][]"},"comment":{"url":"https://api.github.com/repos/privat/nit/issues/comments/126062040","html_url":"https://github.com/privat/nit/pull/1599#issuecomment-126062040","issue_url":"https://api.github.com/repos/privat/nit/issues/1599","id":126062040,"user":{"login":"xymus","id":208057,"avatar_url":"https://avatars.githubusercontent.com/u/208057?v=3","gravatar_id":"","url":"https://api.github.com/users/xymus","html_url":"https://github.com/xymus","followers_url":"https://api.github.com/users/xymus/followers","following_url":"https://api.github.com/users/xymus/following{/other_user}","gists_url":"https://api.github.com/users/xymus/gists{/gist_id}","starred_url":"https://api.github.com/users/xymus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xymus/subscriptions","organizations_url":"https://api.github.com/users/xymus/orgs","repos_url":"https://api.github.com/users/xymus/repos","events_url":"https://api.github.com/users/xymus/events{/privacy}","received_events_url":"https://api.github.com/users/xymus/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T19:11:30Z","updated_at":"2015-07-29T19:11:30Z","body":"Rerolled for @R4PaSs request and to fix the clean workspace problem."}}