{"action":"opened","issue":{"url":"https://api.github.com/repos/OpenHFT/Chronicle-Core/issues/26","repository_url":"https://api.github.com/repos/OpenHFT/Chronicle-Core","labels_url":"https://api.github.com/repos/OpenHFT/Chronicle-Core/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/OpenHFT/Chronicle-Core/issues/26/comments","events_url":"https://api.github.com/repos/OpenHFT/Chronicle-Core/issues/26/events","html_url":"https://github.com/OpenHFT/Chronicle-Core/issues/26","id":202865872,"number":26,"title":"ClassAliasPool.addAlias() causes name collisions and deserialization failure","user":{"login":"amichair","id":1410200,"avatar_url":"https://avatars.githubusercontent.com/u/1410200?v=3","gravatar_id":"","url":"https://api.github.com/users/amichair","html_url":"https://github.com/amichair","followers_url":"https://api.github.com/users/amichair/followers","following_url":"https://api.github.com/users/amichair/following{/other_user}","gists_url":"https://api.github.com/users/amichair/gists{/gist_id}","starred_url":"https://api.github.com/users/amichair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amichair/subscriptions","organizations_url":"https://api.github.com/users/amichair/orgs","repos_url":"https://api.github.com/users/amichair/repos","events_url":"https://api.github.com/users/amichair/events{/privacy}","received_events_url":"https://api.github.com/users/amichair/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-24T16:19:16Z","updated_at":"2017-01-24T16:19:16Z","closed_at":null,"body":"The `addAlias` method uses `Class.getSimpleName()`, which is far from unique. Especially considering inner classes and enums which often use the same name (e.g. 'Type') and are supposed to be distinguished by the containing class name. This causes serialization/deserialization to fail due to a mixup between classes with the same simple name (e.g. said enums).\r\n\r\nFWIW, as a workaround we use something like\r\n`cls.getName().replaceAll(\"(\\\\w)\\\\w*\\\\.\", \"$1\").replace('$', '.')` which has more chances of being unique, yet is still pretty short, along with the overloaded `addAlias` that takes a name per class. Maybe you can use a similar default instead of the class simple name.\r\n"}}
{"actor":{"display_login":"amichair"}}