{"action":"closed","issue":{"url":"https://api.github.com/repos/robovm/robovm/issues/954","labels_url":"https://api.github.com/repos/robovm/robovm/issues/954/labels{/name}","comments_url":"https://api.github.com/repos/robovm/robovm/issues/954/comments","events_url":"https://api.github.com/repos/robovm/robovm/issues/954/events","html_url":"https://github.com/robovm/robovm/issues/954","id":71952971,"number":954,"title":"ObjCObject.toObjCObject() can return instances of an unexpected type","user":{"login":"ntherning","id":135765,"avatar_url":"https://avatars.githubusercontent.com/u/135765?v=3","gravatar_id":"","url":"https://api.github.com/users/ntherning","html_url":"https://github.com/ntherning","followers_url":"https://api.github.com/users/ntherning/followers","following_url":"https://api.github.com/users/ntherning/following{/other_user}","gists_url":"https://api.github.com/users/ntherning/gists{/gist_id}","starred_url":"https://api.github.com/users/ntherning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntherning/subscriptions","organizations_url":"https://api.github.com/users/ntherning/orgs","repos_url":"https://api.github.com/users/ntherning/repos","events_url":"https://api.github.com/users/ntherning/events{/privacy}","received_events_url":"https://api.github.com/users/ntherning/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/robovm/robovm/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"ntherning","id":135765,"avatar_url":"https://avatars.githubusercontent.com/u/135765?v=3","gravatar_id":"","url":"https://api.github.com/users/ntherning","html_url":"https://github.com/ntherning","followers_url":"https://api.github.com/users/ntherning/followers","following_url":"https://api.github.com/users/ntherning/following{/other_user}","gists_url":"https://api.github.com/users/ntherning/gists{/gist_id}","starred_url":"https://api.github.com/users/ntherning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntherning/subscriptions","organizations_url":"https://api.github.com/users/ntherning/orgs","repos_url":"https://api.github.com/users/ntherning/repos","events_url":"https://api.github.com/users/ntherning/events{/privacy}","received_events_url":"https://api.github.com/users/ntherning/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/robovm/robovm/milestones/9","html_url":"https://github.com/robovm/robovm/milestones/1.2","labels_url":"https://api.github.com/repos/robovm/robovm/milestones/9/labels","id":1042803,"number":9,"title":"1.2","description":"","creator":{"login":"ntherning","id":135765,"avatar_url":"https://avatars.githubusercontent.com/u/135765?v=3","gravatar_id":"","url":"https://api.github.com/users/ntherning","html_url":"https://github.com/ntherning","followers_url":"https://api.github.com/users/ntherning/followers","following_url":"https://api.github.com/users/ntherning/following{/other_user}","gists_url":"https://api.github.com/users/ntherning/gists{/gist_id}","starred_url":"https://api.github.com/users/ntherning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntherning/subscriptions","organizations_url":"https://api.github.com/users/ntherning/orgs","repos_url":"https://api.github.com/users/ntherning/repos","events_url":"https://api.github.com/users/ntherning/events{/privacy}","received_events_url":"https://api.github.com/users/ntherning/received_events","type":"User","site_admin":false},"open_issues":54,"closed_issues":38,"state":"open","created_at":"2015-03-28T10:36:57Z","updated_at":"2015-05-06T11:57:29Z","due_on":"2015-05-05T22:00:00Z","closed_at":null},"comments":0,"created_at":"2015-04-29T18:33:02Z","updated_at":"2015-05-06T11:57:29Z","closed_at":"2015-05-06T11:57:29Z","body":"If there already is a peer associated with a native handle but `toObjCObject()` is called with a completely different type not assignment compatible with the type of the peer the peer will still be returned. This is related to #821. We must make sure that `toObjCObject()` never returns an instance of an incompatible type. If the type is forced we should never set that instance as a peer but instead always return a new instance. If the expected type isn't compatible with the current peer's type we should throw an exception unless the peer's type is an `ObjCProxy` kind of class or if the expected type is an interface. If the peer is an `ObjCProxy` we remote it as a peer and create a new one. If the expected type is an interface but the peer isn't compatible we return a new instance without updating the peer."}}