{"action":"created","issue":{"url":"https://api.github.com/repos/dropbox/djinni/issues/168","labels_url":"https://api.github.com/repos/dropbox/djinni/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/dropbox/djinni/issues/168/comments","events_url":"https://api.github.com/repos/dropbox/djinni/issues/168/events","html_url":"https://github.com/dropbox/djinni/issues/168","id":117623657,"number":168,"title":"Creating Java interfaces objects in C++","user":{"login":"awhlee","id":839179,"avatar_url":"https://avatars.githubusercontent.com/u/839179?v=3","gravatar_id":"","url":"https://api.github.com/users/awhlee","html_url":"https://github.com/awhlee","followers_url":"https://api.github.com/users/awhlee/followers","following_url":"https://api.github.com/users/awhlee/following{/other_user}","gists_url":"https://api.github.com/users/awhlee/gists{/gist_id}","starred_url":"https://api.github.com/users/awhlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awhlee/subscriptions","organizations_url":"https://api.github.com/users/awhlee/orgs","repos_url":"https://api.github.com/users/awhlee/repos","events_url":"https://api.github.com/users/awhlee/events{/privacy}","received_events_url":"https://api.github.com/users/awhlee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-18T16:24:07Z","updated_at":"2015-11-18T16:44:02Z","closed_at":null,"body":"Hi,\r\n\r\nI'm new to Djinni so please excuse my basic question.  I'm trying to create an interface that is instantiated in C++ but implemented in Java.  I have this in my Djinni file:\r\n\r\nPlatformNetworkService = interface +j {\r\n    makeRequest(url: string): string;\r\n}\r\n\r\nIn the other direction, it seems like the standard convention is to create a static factory function to instantiate the object in Java when it is implemented in C++.  I tried putting a static \"createInstance\" function on this interface:\r\n\r\nPlatformNotificationService = interface +j {\r\n    static createInstance(): PlatformNotificationService;\r\n    notifyOfChange(): i32;\r\n}\r\n\r\nBut I get an error \"static not allowed for +j or +o interfaces\".  I feel that I'm overlooking something really basic.\r\n\r\nPlease advise how to create Java interface objects in C++.  Thanks in advance.\r\n"},"comment":{"url":"https://api.github.com/repos/dropbox/djinni/issues/comments/157773077","html_url":"https://github.com/dropbox/djinni/issues/168#issuecomment-157773077","issue_url":"https://api.github.com/repos/dropbox/djinni/issues/168","id":157773077,"user":{"login":"awhlee","id":839179,"avatar_url":"https://avatars.githubusercontent.com/u/839179?v=3","gravatar_id":"","url":"https://api.github.com/users/awhlee","html_url":"https://github.com/awhlee","followers_url":"https://api.github.com/users/awhlee/followers","following_url":"https://api.github.com/users/awhlee/following{/other_user}","gists_url":"https://api.github.com/users/awhlee/gists{/gist_id}","starred_url":"https://api.github.com/users/awhlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awhlee/subscriptions","organizations_url":"https://api.github.com/users/awhlee/orgs","repos_url":"https://api.github.com/users/awhlee/repos","events_url":"https://api.github.com/users/awhlee/events{/privacy}","received_events_url":"https://api.github.com/users/awhlee/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T16:44:02Z","updated_at":"2015-11-18T16:44:02Z","body":"In the sample code, it seems that the interface that is implemented in Java or Obj-C is passed as a parameter to the static factory function of the C++ class and that is how the C++ code can use that interface.  It doesn't instantiate its own instance but uses the reference that it was provided.  I guess that is the design that needs to be followed?"}}