{"action":"created","comment":{"url":"https://api.github.com/repos/INRIA/spoon/pulls/comments/39557685","id":39557685,"diff_hunk":"@@ -150,4 +152,87 @@ public void testPrintAMethodWithGeneric() throws Exception {\n \t\tassertTrue(ctTypeReference instanceof CtImplicitTypeReference);\n \t\tassertEquals(\"Object\", ctTypeReference.getSimpleName());\n \t}\n+\n+\t@Test\n+\tpublic void autoImportUsesFullyQualifiedNameWhenImportedNameAlreadyPresent() throws Exception {\n+\t\tFactory factory = TestUtils.build( spoon.test.prettyprinter.testclasses.sub.TypeIdentifierCollision.class, spoon.test.prettyprinter.testclasses.TypeIdentifierCollision.class );\n+\t\tfactory.getEnvironment().setAutoImports(true);\n+\n+\t\tfinal CtClass<?> aClass = (CtClass<?>) factory.Type().get( spoon.test.prettyprinter.testclasses.TypeIdentifierCollision.class );\n+\n+\t\tString expected =\n+\t\t\t\"public void setFieldUsingExternallyDefinedEnumWithSameNameAsLocal() {\" +nl+\n+\t\t\t\"    localField = spoon.test.prettyprinter.testclasses.sub.TypeIdentifierCollision.ENUM.E1.ordinal();\" +nl+\n+\t\t\t\"}\"\n+\t\t;\n+\t\tString computed = aClass.getMethodsByName(\"setFieldUsingExternallyDefinedEnumWithSameNameAsLocal\").get(0).toString();\n+\t\tassertEquals( \"the externally defined enum should be fully qualified to avoid a name clash with the local enum of the same name\", expected, computed );\n+\n+\t\texpected = //This is what is expected\n+\t\t\t\"public void setFieldUsingLocallyDefinedEnum() {\" +nl+\n+\t\t\t\"    localField = ENUM.E1.ordinal();\" +nl+\n+\t\t\t\"}\"\n+\t\t;\n+\t\texpected = //This is correct however it could be more concise.","path":"src/test/java/spoon/test/prettyprinter/DefaultPrettyPrinterTest.java","position":165,"original_position":165,"commit_id":"e060e27b5b87f1a6323ef4a2945ca6499ef4ad4f","original_commit_id":"e060e27b5b87f1a6323ef4a2945ca6499ef4ad4f","user":{"login":"monperrus","id":803666,"avatar_url":"https://avatars.githubusercontent.com/u/803666?v=3","gravatar_id":"","url":"https://api.github.com/users/monperrus","html_url":"https://github.com/monperrus","followers_url":"https://api.github.com/users/monperrus/followers","following_url":"https://api.github.com/users/monperrus/following{/other_user}","gists_url":"https://api.github.com/users/monperrus/gists{/gist_id}","starred_url":"https://api.github.com/users/monperrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monperrus/subscriptions","organizations_url":"https://api.github.com/users/monperrus/orgs","repos_url":"https://api.github.com/users/monperrus/repos","events_url":"https://api.github.com/users/monperrus/events{/privacy}","received_events_url":"https://api.github.com/users/monperrus/received_events","type":"User","site_admin":false},"body":"we should only keep one \"expected\"","created_at":"2015-09-15T20:05:15Z","updated_at":"2015-09-15T20:05:15Z","html_url":"https://github.com/INRIA/spoon/pull/289#discussion_r39557685","pull_request_url":"https://api.github.com/repos/INRIA/spoon/pulls/289","_links":{"self":{"href":"https://api.github.com/repos/INRIA/spoon/pulls/comments/39557685"},"html":{"href":"https://github.com/INRIA/spoon/pull/289#discussion_r39557685"},"pull_request":{"href":"https://api.github.com/repos/INRIA/spoon/pulls/289"}}},"pull_request":{"url":"https://api.github.com/repos/INRIA/spoon/pulls/289","id":41147722,"html_url":"https://github.com/INRIA/spoon/pull/289","diff_url":"https://github.com/INRIA/spoon/pull/289.diff","patch_url":"https://github.com/INRIA/spoon/pull/289.patch","issue_url":"https://api.github.com/repos/INRIA/spoon/issues/289","number":289,"state":"open","locked":false,"title":"Added correct handling for enum's listed in an enum definition (CtEnum)","user":{"login":"adamjryan","id":6782541,"avatar_url":"https://avatars.githubusercontent.com/u/6782541?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjryan","html_url":"https://github.com/adamjryan","followers_url":"https://api.github.com/users/adamjryan/followers","following_url":"https://api.github.com/users/adamjryan/following{/other_user}","gists_url":"https://api.github.com/users/adamjryan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjryan/subscriptions","organizations_url":"https://api.github.com/users/adamjryan/orgs","repos_url":"https://api.github.com/users/adamjryan/repos","events_url":"https://api.github.com/users/adamjryan/events{/privacy}","received_events_url":"https://api.github.com/users/adamjryan/received_events","type":"User","site_admin":false},"body":"- before the toString() method was simply used which does not take\r\naccount of the compilation unit's context.\r\n* Removed the compute imports statement from CtElement's toString()\r\nmethod as it has no context and therefore it cannot assume the\r\ncorresponding import is present that would allow it to be shown in\r\nthe shortened version.\r\n* Added test to catch some edge cases in the shortening of identifiers\r\nthat may produce ambiguous/invalid code and updated ones that relied on\r\nthe toString() method to calculate the shorthand names.\r\n* Made some minor modifications to remove some warnings in the code\r\nas flagged by the IDE.","created_at":"2015-07-29T17:07:44Z","updated_at":"2015-09-15T20:05:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18993b83f6d154208af734b918b49250a33d15bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/INRIA/spoon/pulls/289/commits","review_comments_url":"https://api.github.com/repos/INRIA/spoon/pulls/289/comments","review_comment_url":"https://api.github.com/repos/INRIA/spoon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/INRIA/spoon/issues/289/comments","statuses_url":"https://api.github.com/repos/INRIA/spoon/statuses/e060e27b5b87f1a6323ef4a2945ca6499ef4ad4f","head":{"label":"adamjryan:correct_enum_prettyprint","ref":"correct_enum_prettyprint","sha":"e060e27b5b87f1a6323ef4a2945ca6499ef4ad4f","user":{"login":"adamjryan","id":6782541,"avatar_url":"https://avatars.githubusercontent.com/u/6782541?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjryan","html_url":"https://github.com/adamjryan","followers_url":"https://api.github.com/users/adamjryan/followers","following_url":"https://api.github.com/users/adamjryan/following{/other_user}","gists_url":"https://api.github.com/users/adamjryan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjryan/subscriptions","organizations_url":"https://api.github.com/users/adamjryan/orgs","repos_url":"https://api.github.com/users/adamjryan/repos","events_url":"https://api.github.com/users/adamjryan/events{/privacy}","received_events_url":"https://api.github.com/users/adamjryan/received_events","type":"User","site_admin":false},"repo":{"id":38874428,"name":"spoon","full_name":"adamjryan/spoon","owner":{"login":"adamjryan","id":6782541,"avatar_url":"https://avatars.githubusercontent.com/u/6782541?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjryan","html_url":"https://github.com/adamjryan","followers_url":"https://api.github.com/users/adamjryan/followers","following_url":"https://api.github.com/users/adamjryan/following{/other_user}","gists_url":"https://api.github.com/users/adamjryan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjryan/subscriptions","organizations_url":"https://api.github.com/users/adamjryan/orgs","repos_url":"https://api.github.com/users/adamjryan/repos","events_url":"https://api.github.com/users/adamjryan/events{/privacy}","received_events_url":"https://api.github.com/users/adamjryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamjryan/spoon","description":"Spoon is a library for analyzing and transforming Java source code.","fork":true,"url":"https://api.github.com/repos/adamjryan/spoon","forks_url":"https://api.github.com/repos/adamjryan/spoon/forks","keys_url":"https://api.github.com/repos/adamjryan/spoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamjryan/spoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamjryan/spoon/teams","hooks_url":"https://api.github.com/repos/adamjryan/spoon/hooks","issue_events_url":"https://api.github.com/repos/adamjryan/spoon/issues/events{/number}","events_url":"https://api.github.com/repos/adamjryan/spoon/events","assignees_url":"https://api.github.com/repos/adamjryan/spoon/assignees{/user}","branches_url":"https://api.github.com/repos/adamjryan/spoon/branches{/branch}","tags_url":"https://api.github.com/repos/adamjryan/spoon/tags","blobs_url":"https://api.github.com/repos/adamjryan/spoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamjryan/spoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamjryan/spoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamjryan/spoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamjryan/spoon/statuses/{sha}","languages_url":"https://api.github.com/repos/adamjryan/spoon/languages","stargazers_url":"https://api.github.com/repos/adamjryan/spoon/stargazers","contributors_url":"https://api.github.com/repos/adamjryan/spoon/contributors","subscribers_url":"https://api.github.com/repos/adamjryan/spoon/subscribers","subscription_url":"https://api.github.com/repos/adamjryan/spoon/subscription","commits_url":"https://api.github.com/repos/adamjryan/spoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamjryan/spoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamjryan/spoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamjryan/spoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamjryan/spoon/contents/{+path}","compare_url":"https://api.github.com/repos/adamjryan/spoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamjryan/spoon/merges","archive_url":"https://api.github.com/repos/adamjryan/spoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamjryan/spoon/downloads","issues_url":"https://api.github.com/repos/adamjryan/spoon/issues{/number}","pulls_url":"https://api.github.com/repos/adamjryan/spoon/pulls{/number}","milestones_url":"https://api.github.com/repos/adamjryan/spoon/milestones{/number}","notifications_url":"https://api.github.com/repos/adamjryan/spoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamjryan/spoon/labels{/name}","releases_url":"https://api.github.com/repos/adamjryan/spoon/releases{/id}","created_at":"2015-07-10T10:11:33Z","updated_at":"2015-07-10T10:11:34Z","pushed_at":"2015-09-15T19:39:35Z","git_url":"git://github.com/adamjryan/spoon.git","ssh_url":"git@github.com:adamjryan/spoon.git","clone_url":"https://github.com/adamjryan/spoon.git","svn_url":"https://github.com/adamjryan/spoon","homepage":"http://spoon.gforge.inria.fr/","size":8203,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"INRIA:master","ref":"master","sha":"5f3dc71a95eef8ee3480eb6507dd7baf8dbbdbe2","user":{"login":"INRIA","id":2951919,"avatar_url":"https://avatars.githubusercontent.com/u/2951919?v=3","gravatar_id":"","url":"https://api.github.com/users/INRIA","html_url":"https://github.com/INRIA","followers_url":"https://api.github.com/users/INRIA/followers","following_url":"https://api.github.com/users/INRIA/following{/other_user}","gists_url":"https://api.github.com/users/INRIA/gists{/gist_id}","starred_url":"https://api.github.com/users/INRIA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/INRIA/subscriptions","organizations_url":"https://api.github.com/users/INRIA/orgs","repos_url":"https://api.github.com/users/INRIA/repos","events_url":"https://api.github.com/users/INRIA/events{/privacy}","received_events_url":"https://api.github.com/users/INRIA/received_events","type":"Organization","site_admin":false},"repo":{"id":14176513,"name":"spoon","full_name":"INRIA/spoon","owner":{"login":"INRIA","id":2951919,"avatar_url":"https://avatars.githubusercontent.com/u/2951919?v=3","gravatar_id":"","url":"https://api.github.com/users/INRIA","html_url":"https://github.com/INRIA","followers_url":"https://api.github.com/users/INRIA/followers","following_url":"https://api.github.com/users/INRIA/following{/other_user}","gists_url":"https://api.github.com/users/INRIA/gists{/gist_id}","starred_url":"https://api.github.com/users/INRIA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/INRIA/subscriptions","organizations_url":"https://api.github.com/users/INRIA/orgs","repos_url":"https://api.github.com/users/INRIA/repos","events_url":"https://api.github.com/users/INRIA/events{/privacy}","received_events_url":"https://api.github.com/users/INRIA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/INRIA/spoon","description":"Spoon is a library for analyzing and transforming Java source code (1.8 included) .","fork":false,"url":"https://api.github.com/repos/INRIA/spoon","forks_url":"https://api.github.com/repos/INRIA/spoon/forks","keys_url":"https://api.github.com/repos/INRIA/spoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/INRIA/spoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/INRIA/spoon/teams","hooks_url":"https://api.github.com/repos/INRIA/spoon/hooks","issue_events_url":"https://api.github.com/repos/INRIA/spoon/issues/events{/number}","events_url":"https://api.github.com/repos/INRIA/spoon/events","assignees_url":"https://api.github.com/repos/INRIA/spoon/assignees{/user}","branches_url":"https://api.github.com/repos/INRIA/spoon/branches{/branch}","tags_url":"https://api.github.com/repos/INRIA/spoon/tags","blobs_url":"https://api.github.com/repos/INRIA/spoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/INRIA/spoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/INRIA/spoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/INRIA/spoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/INRIA/spoon/statuses/{sha}","languages_url":"https://api.github.com/repos/INRIA/spoon/languages","stargazers_url":"https://api.github.com/repos/INRIA/spoon/stargazers","contributors_url":"https://api.github.com/repos/INRIA/spoon/contributors","subscribers_url":"https://api.github.com/repos/INRIA/spoon/subscribers","subscription_url":"https://api.github.com/repos/INRIA/spoon/subscription","commits_url":"https://api.github.com/repos/INRIA/spoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/INRIA/spoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/INRIA/spoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/INRIA/spoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/INRIA/spoon/contents/{+path}","compare_url":"https://api.github.com/repos/INRIA/spoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/INRIA/spoon/merges","archive_url":"https://api.github.com/repos/INRIA/spoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/INRIA/spoon/downloads","issues_url":"https://api.github.com/repos/INRIA/spoon/issues{/number}","pulls_url":"https://api.github.com/repos/INRIA/spoon/pulls{/number}","milestones_url":"https://api.github.com/repos/INRIA/spoon/milestones{/number}","notifications_url":"https://api.github.com/repos/INRIA/spoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/INRIA/spoon/labels{/name}","releases_url":"https://api.github.com/repos/INRIA/spoon/releases{/id}","created_at":"2013-11-06T15:29:59Z","updated_at":"2015-09-14T09:25:22Z","pushed_at":"2015-09-15T19:39:36Z","git_url":"git://github.com/INRIA/spoon.git","ssh_url":"git@github.com:INRIA/spoon.git","clone_url":"https://github.com/INRIA/spoon.git","svn_url":"https://github.com/INRIA/spoon","homepage":"http://spoon.gforge.inria.fr/","size":10501,"stargazers_count":89,"watchers_count":89,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":24,"forks":31,"open_issues":24,"watchers":89,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/INRIA/spoon/pulls/289"},"html":{"href":"https://github.com/INRIA/spoon/pull/289"},"issue":{"href":"https://api.github.com/repos/INRIA/spoon/issues/289"},"comments":{"href":"https://api.github.com/repos/INRIA/spoon/issues/289/comments"},"review_comments":{"href":"https://api.github.com/repos/INRIA/spoon/pulls/289/comments"},"review_comment":{"href":"https://api.github.com/repos/INRIA/spoon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/INRIA/spoon/pulls/289/commits"},"statuses":{"href":"https://api.github.com/repos/INRIA/spoon/statuses/e060e27b5b87f1a6323ef4a2945ca6499ef4ad4f"}}}}