{"action":"created","comment":{"url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/comments/31391096","id":31391096,"diff_hunk":"@@ -882,22 +883,66 @@ trait PimpedTrees {\n    * object.\n    */\n   object ModifierTree {\n+    import Flags._\n+\n     def unapply(m: global.Modifiers): Option[List[ModifierTree]] = {\n       val flagSorter = Ordering.by((pair: (Long, Position)) => flagPosition(pair._1))\n       val sortedMods = m.positions.toList.sorted(flagSorter)\n \n-      Some(sortedMods map {\n+      Some(sortedMods flatMap {\n         // hack to get rid of override modifiers\n         // couldn't figure out how to remove a flag from the positions map (michael)\n         case (Flags.OVERRIDE, _) if (m.flags & Flags.OVERRIDE) == 0 =>\n-          ModifierTree(0)\n+          Seq(ModifierTree(0))\n         case (flag, pos) if pos.isRange =>\n-          ModifierTree(flag) setPos (pos withEnd (pos.end + 1))\n+          val fixedEnd = {\n+            if (flag == PRIVATE) fixEndForScopedAccessModifier(pos)\n+            else pos.end + 1\n+          }\n+\n+          /*\n+           *  Unfortunately package private and protected vals/defs (like \"private[pgk] val test = 2\") might not be properly represented\n+           *  in 'm.positions' (see https://www.assembla.com/spaces/scala-ide/tickets/1002446#/activity/ticket:). We therefore\n+           *  add the associated modifier trees \"by-hand\" if needed.\n+           */\n+          val missingModifierTree = {\n+            if (m.privateWithin.nonEmpty && pos.end - pos.start < 3) {\n+              val srcAtModifierEnd = SourceWithMarker(pos.source.content, pos.start - 1).moveMarker(commentsAndSpaces.backward)\n+\n+              val srcAtModifierStart = srcAtModifierEnd.moveMarker(\n+                  ((\"private\" | \"protected\") ~\n+                  commentsAndSpaces ~ bracketsWithContents ~ commentsAndSpaces).backward)\n+\n+              Some(ModifierTree(extractAccessModifier(flag)).setPos(pos.withStart(srcAtModifierStart.marker + 1).withEnd(srcAtModifierEnd.marker + 1)))","path":"org.scala-refactoring.library/src/main/scala/scala/tools/refactoring/common/PimpedTrees.scala","position":48,"original_position":48,"commit_id":"8cd11305cfaa60f44d502d4f08ff605a3a38f2c8","original_commit_id":"8cd11305cfaa60f44d502d4f08ff605a3a38f2c8","user":{"login":"misto","id":2111,"avatar_url":"https://avatars.githubusercontent.com/u/2111?v=3","gravatar_id":"","url":"https://api.github.com/users/misto","html_url":"https://github.com/misto","followers_url":"https://api.github.com/users/misto/followers","following_url":"https://api.github.com/users/misto/following{/other_user}","gists_url":"https://api.github.com/users/misto/gists{/gist_id}","starred_url":"https://api.github.com/users/misto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misto/subscriptions","organizations_url":"https://api.github.com/users/misto/orgs","repos_url":"https://api.github.com/users/misto/repos","events_url":"https://api.github.com/users/misto/events{/privacy}","received_events_url":"https://api.github.com/users/misto/received_events","type":"User","site_admin":false},"body":"Could maybe made more readable by having a method in SourceWithMarker that returns a position instead of the int-marker?","created_at":"2015-05-31T15:14:11Z","updated_at":"2015-05-31T15:14:11Z","html_url":"https://github.com/scala-ide/scala-refactoring/pull/83#discussion_r31391096","pull_request_url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/comments/31391096"},"html":{"href":"https://github.com/scala-ide/scala-refactoring/pull/83#discussion_r31391096"},"pull_request":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83","id":36581226,"html_url":"https://github.com/scala-ide/scala-refactoring/pull/83","diff_url":"https://github.com/scala-ide/scala-refactoring/pull/83.diff","patch_url":"https://github.com/scala-ide/scala-refactoring/pull/83.patch","issue_url":"https://api.github.com/repos/scala-ide/scala-refactoring/issues/83","number":83,"state":"open","locked":false,"title":"Rename package private vals/defs with scoped access modifiers","user":{"login":"mlangc","id":7326646,"avatar_url":"https://avatars.githubusercontent.com/u/7326646?v=3","gravatar_id":"","url":"https://api.github.com/users/mlangc","html_url":"https://github.com/mlangc","followers_url":"https://api.github.com/users/mlangc/followers","following_url":"https://api.github.com/users/mlangc/following{/other_user}","gists_url":"https://api.github.com/users/mlangc/gists{/gist_id}","starred_url":"https://api.github.com/users/mlangc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlangc/subscriptions","organizations_url":"https://api.github.com/users/mlangc/orgs","repos_url":"https://api.github.com/users/mlangc/repos","events_url":"https://api.github.com/users/mlangc/events{/privacy}","received_events_url":"https://api.github.com/users/mlangc/received_events","type":"User","site_admin":false},"body":"This PR introduces my attempt to fix [Ticket 1002446](https://www.assembla.com/spaces/scala-ide/tickets/1002446#/activity/ticket:). Unfortunately there are still problems in connection with *lazy* vals (see https://github.com/mlangc/scala-refactoring/blob/rename-package-private-removes-access-modifiers-1002446/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/RenameTest.scala#L1862), and I think also with *override*, but we might want to deal with these in separate tickets and PRs.\r\n\r\nAs for the code itself: The biggest addition of this PR are the utility classes `scala.tools.refactoring.util.SourceWithMarker` together with `scala.tools.refactoring.util.SourceWithMarker.Movement`. These classes are documented in the source and currently used in `scala.tools.refactoring.common.PimpedTrees.ModifierTree` to work around some limitations/bugs of the ASTs provided by the compiler.","created_at":"2015-05-31T12:13:37Z","updated_at":"2015-05-31T15:14:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b817f784b82594c3c5e04fd1cdf429797a449ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83/commits","review_comments_url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83/comments","review_comment_url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala-ide/scala-refactoring/issues/83/comments","statuses_url":"https://api.github.com/repos/scala-ide/scala-refactoring/statuses/8cd11305cfaa60f44d502d4f08ff605a3a38f2c8","head":{"label":"mlangc:rename-package-private-removes-access-modifiers-1002446","ref":"rename-package-private-removes-access-modifiers-1002446","sha":"8cd11305cfaa60f44d502d4f08ff605a3a38f2c8","user":{"login":"mlangc","id":7326646,"avatar_url":"https://avatars.githubusercontent.com/u/7326646?v=3","gravatar_id":"","url":"https://api.github.com/users/mlangc","html_url":"https://github.com/mlangc","followers_url":"https://api.github.com/users/mlangc/followers","following_url":"https://api.github.com/users/mlangc/following{/other_user}","gists_url":"https://api.github.com/users/mlangc/gists{/gist_id}","starred_url":"https://api.github.com/users/mlangc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlangc/subscriptions","organizations_url":"https://api.github.com/users/mlangc/orgs","repos_url":"https://api.github.com/users/mlangc/repos","events_url":"https://api.github.com/users/mlangc/events{/privacy}","received_events_url":"https://api.github.com/users/mlangc/received_events","type":"User","site_admin":false},"repo":{"id":25032286,"name":"scala-refactoring","full_name":"mlangc/scala-refactoring","owner":{"login":"mlangc","id":7326646,"avatar_url":"https://avatars.githubusercontent.com/u/7326646?v=3","gravatar_id":"","url":"https://api.github.com/users/mlangc","html_url":"https://github.com/mlangc","followers_url":"https://api.github.com/users/mlangc/followers","following_url":"https://api.github.com/users/mlangc/following{/other_user}","gists_url":"https://api.github.com/users/mlangc/gists{/gist_id}","starred_url":"https://api.github.com/users/mlangc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlangc/subscriptions","organizations_url":"https://api.github.com/users/mlangc/orgs","repos_url":"https://api.github.com/users/mlangc/repos","events_url":"https://api.github.com/users/mlangc/events{/privacy}","received_events_url":"https://api.github.com/users/mlangc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mlangc/scala-refactoring","description":"A library providing automated refactoring support for Scala.","fork":true,"url":"https://api.github.com/repos/mlangc/scala-refactoring","forks_url":"https://api.github.com/repos/mlangc/scala-refactoring/forks","keys_url":"https://api.github.com/repos/mlangc/scala-refactoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlangc/scala-refactoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlangc/scala-refactoring/teams","hooks_url":"https://api.github.com/repos/mlangc/scala-refactoring/hooks","issue_events_url":"https://api.github.com/repos/mlangc/scala-refactoring/issues/events{/number}","events_url":"https://api.github.com/repos/mlangc/scala-refactoring/events","assignees_url":"https://api.github.com/repos/mlangc/scala-refactoring/assignees{/user}","branches_url":"https://api.github.com/repos/mlangc/scala-refactoring/branches{/branch}","tags_url":"https://api.github.com/repos/mlangc/scala-refactoring/tags","blobs_url":"https://api.github.com/repos/mlangc/scala-refactoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlangc/scala-refactoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlangc/scala-refactoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlangc/scala-refactoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlangc/scala-refactoring/statuses/{sha}","languages_url":"https://api.github.com/repos/mlangc/scala-refactoring/languages","stargazers_url":"https://api.github.com/repos/mlangc/scala-refactoring/stargazers","contributors_url":"https://api.github.com/repos/mlangc/scala-refactoring/contributors","subscribers_url":"https://api.github.com/repos/mlangc/scala-refactoring/subscribers","subscription_url":"https://api.github.com/repos/mlangc/scala-refactoring/subscription","commits_url":"https://api.github.com/repos/mlangc/scala-refactoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlangc/scala-refactoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlangc/scala-refactoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlangc/scala-refactoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlangc/scala-refactoring/contents/{+path}","compare_url":"https://api.github.com/repos/mlangc/scala-refactoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlangc/scala-refactoring/merges","archive_url":"https://api.github.com/repos/mlangc/scala-refactoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlangc/scala-refactoring/downloads","issues_url":"https://api.github.com/repos/mlangc/scala-refactoring/issues{/number}","pulls_url":"https://api.github.com/repos/mlangc/scala-refactoring/pulls{/number}","milestones_url":"https://api.github.com/repos/mlangc/scala-refactoring/milestones{/number}","notifications_url":"https://api.github.com/repos/mlangc/scala-refactoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlangc/scala-refactoring/labels{/name}","releases_url":"https://api.github.com/repos/mlangc/scala-refactoring/releases{/id}","created_at":"2014-10-10T11:15:33Z","updated_at":"2015-05-03T14:31:59Z","pushed_at":"2015-05-31T12:23:18Z","git_url":"git://github.com/mlangc/scala-refactoring.git","ssh_url":"git@github.com:mlangc/scala-refactoring.git","clone_url":"https://github.com/mlangc/scala-refactoring.git","svn_url":"https://github.com/mlangc/scala-refactoring","homepage":"http://scala-refactoring.org/","size":7448,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"scala-ide:master","ref":"master","sha":"be322ce8291de71d957516a3cf2b53bd44c19ece","user":{"login":"scala-ide","id":1026788,"avatar_url":"https://avatars.githubusercontent.com/u/1026788?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-ide","html_url":"https://github.com/scala-ide","followers_url":"https://api.github.com/users/scala-ide/followers","following_url":"https://api.github.com/users/scala-ide/following{/other_user}","gists_url":"https://api.github.com/users/scala-ide/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-ide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-ide/subscriptions","organizations_url":"https://api.github.com/users/scala-ide/orgs","repos_url":"https://api.github.com/users/scala-ide/repos","events_url":"https://api.github.com/users/scala-ide/events{/privacy}","received_events_url":"https://api.github.com/users/scala-ide/received_events","type":"Organization","site_admin":false},"repo":{"id":2820107,"name":"scala-refactoring","full_name":"scala-ide/scala-refactoring","owner":{"login":"scala-ide","id":1026788,"avatar_url":"https://avatars.githubusercontent.com/u/1026788?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-ide","html_url":"https://github.com/scala-ide","followers_url":"https://api.github.com/users/scala-ide/followers","following_url":"https://api.github.com/users/scala-ide/following{/other_user}","gists_url":"https://api.github.com/users/scala-ide/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-ide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-ide/subscriptions","organizations_url":"https://api.github.com/users/scala-ide/orgs","repos_url":"https://api.github.com/users/scala-ide/repos","events_url":"https://api.github.com/users/scala-ide/events{/privacy}","received_events_url":"https://api.github.com/users/scala-ide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala-ide/scala-refactoring","description":"A library providing automated refactoring support for Scala.","fork":false,"url":"https://api.github.com/repos/scala-ide/scala-refactoring","forks_url":"https://api.github.com/repos/scala-ide/scala-refactoring/forks","keys_url":"https://api.github.com/repos/scala-ide/scala-refactoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala-ide/scala-refactoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala-ide/scala-refactoring/teams","hooks_url":"https://api.github.com/repos/scala-ide/scala-refactoring/hooks","issue_events_url":"https://api.github.com/repos/scala-ide/scala-refactoring/issues/events{/number}","events_url":"https://api.github.com/repos/scala-ide/scala-refactoring/events","assignees_url":"https://api.github.com/repos/scala-ide/scala-refactoring/assignees{/user}","branches_url":"https://api.github.com/repos/scala-ide/scala-refactoring/branches{/branch}","tags_url":"https://api.github.com/repos/scala-ide/scala-refactoring/tags","blobs_url":"https://api.github.com/repos/scala-ide/scala-refactoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala-ide/scala-refactoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala-ide/scala-refactoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala-ide/scala-refactoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala-ide/scala-refactoring/statuses/{sha}","languages_url":"https://api.github.com/repos/scala-ide/scala-refactoring/languages","stargazers_url":"https://api.github.com/repos/scala-ide/scala-refactoring/stargazers","contributors_url":"https://api.github.com/repos/scala-ide/scala-refactoring/contributors","subscribers_url":"https://api.github.com/repos/scala-ide/scala-refactoring/subscribers","subscription_url":"https://api.github.com/repos/scala-ide/scala-refactoring/subscription","commits_url":"https://api.github.com/repos/scala-ide/scala-refactoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala-ide/scala-refactoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala-ide/scala-refactoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala-ide/scala-refactoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala-ide/scala-refactoring/contents/{+path}","compare_url":"https://api.github.com/repos/scala-ide/scala-refactoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala-ide/scala-refactoring/merges","archive_url":"https://api.github.com/repos/scala-ide/scala-refactoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala-ide/scala-refactoring/downloads","issues_url":"https://api.github.com/repos/scala-ide/scala-refactoring/issues{/number}","pulls_url":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls{/number}","milestones_url":"https://api.github.com/repos/scala-ide/scala-refactoring/milestones{/number}","notifications_url":"https://api.github.com/repos/scala-ide/scala-refactoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala-ide/scala-refactoring/labels{/name}","releases_url":"https://api.github.com/repos/scala-ide/scala-refactoring/releases{/id}","created_at":"2011-11-21T13:35:19Z","updated_at":"2015-05-03T09:14:14Z","pushed_at":"2015-05-31T12:23:18Z","git_url":"git://github.com/scala-ide/scala-refactoring.git","ssh_url":"git@github.com:scala-ide/scala-refactoring.git","clone_url":"https://github.com/scala-ide/scala-refactoring.git","svn_url":"https://github.com/scala-ide/scala-refactoring","homepage":"http://scala-refactoring.org/","size":8127,"stargazers_count":22,"watchers_count":22,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":9,"forks":26,"open_issues":9,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83"},"html":{"href":"https://github.com/scala-ide/scala-refactoring/pull/83"},"issue":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/issues/83"},"comments":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/scala-ide/scala-refactoring/statuses/8cd11305cfaa60f44d502d4f08ff605a3a38f2c8"}}}}