{"action":"created","comment":{"url":"https://api.github.com/repos/JetBrains/intellij-community/pulls/comments/57349806","id":57349806,"diff_hunk":"@@ -0,0 +1,193 @@\n+/*\n+ * Copyright 2000-2016 JetBrains s.r.o.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jetbrains.plugins.groovy.inspections\n+\n+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase\n+import org.intellij.lang.annotations.Language\n+import org.jetbrains.plugins.groovy.codeInspection.changeToOperator.ChangeToOperatorInspection\n+\n+import java.util.regex.Pattern\n+\n+import static org.jetbrains.plugins.groovy.GroovyFileType.GROOVY_FILE_TYPE\n+import static org.jetbrains.plugins.groovy.util.TestUtils.CARET_MARKER\n+\n+public class GrChangeToOperatorTest extends LightCodeInsightFixtureTestCase {\n+  def inspection = new ChangeToOperatorInspection()\n+\n+  void testSimpleUnaryExpression() {\n+    assertValid(/a.bitwiseNegate()/, /~a/)\n+    assertValid(/a.negative()/, /-a/)\n+    assertValid(/a.positive()/, /+a/)\n+    assertValid(/a.call()/, /a()/)\n+    assertValid(/a.next()/, /++a/)\n+    assertValid(/a.previous()/, /--a/)\n+  }\n+\n+  void testNegatableUnaryExpression() {\n+    assertValid(/a.asBoolean()/, /!!a/)\n+    assertValid(/!a.asBoolean()/, /!a/)\n+\n+    assertValid(/if (${_}a.asBoolean()${_});/, /a/)\n+    assertValid(/if (${_}!a.asBoolean()${_});/, /!a/)\n+  }\n+\n+  // TODO  ","path":"plugins/groovy/test/org/jetbrains/plugins/groovy/inspections/GrChangeToOperatorTest.groovy","position":47,"original_position":47,"commit_id":"ed6338e645524adbb0525f0e83d613e192b8454e","original_commit_id":"ed6338e645524adbb0525f0e83d613e192b8454e","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"body":"these are working correctly from the IDE","created_at":"2016-03-24T16:59:46Z","updated_at":"2016-03-24T16:59:46Z","html_url":"https://github.com/JetBrains/intellij-community/pull/311#discussion_r57349806","pull_request_url":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311","_links":{"self":{"href":"https://api.github.com/repos/JetBrains/intellij-community/pulls/comments/57349806"},"html":{"href":"https://github.com/JetBrains/intellij-community/pull/311#discussion_r57349806"},"pull_request":{"href":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311"}}},"pull_request":{"url":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311","id":48491017,"html_url":"https://github.com/JetBrains/intellij-community/pull/311","diff_url":"https://github.com/JetBrains/intellij-community/pull/311.diff","patch_url":"https://github.com/JetBrains/intellij-community/pull/311.patch","issue_url":"https://api.github.com/repos/JetBrains/intellij-community/issues/311","number":311,"state":"open","locked":false,"title":"Added `Convert to Operator` Groovy inspection","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"body":"Fixes https://youtrack.jetbrains.com/issue/IDEA-95818\r\n```\r\na.bitwiseNegate()       → ~a       \r\na.negative()            → -a       \r\na.positive()            → +a       \r\na.call()                → a()      \r\na.next()                → ++a      \r\na.previous()            → --a      \r\n\r\na.asBoolean()           → !!a      \r\n!a.asBoolean()          → !a       \r\n\r\nif (a.asBoolean())      → if (a)\r\nif (!a.asBoolean())     → if (!a)\r\n\r\na.minus(b)              → a - b    \r\na.plus(b)               → a + b    \r\na.power(b)              → a**b     \r\na.div(b)                → a / b    \r\na.mod(b)                → a % b    \r\na.or(b)                 → a | b    \r\na.and(b)                → a & b    \r\na.xor(b)                → a ^ b    \r\na.leftShift(b)          → a << b   \r\na.rightShift(b)         → a >> b   \r\na.rightShiftUnsigned(b) → a >>> b  \r\n\r\na.asType(b)             → a as b   \r\na.multiply(b)           → a * b    \r\nb.isCase(a)             → a in b   \r\n\r\na.equals(b)             → a == b   \r\n!a.equals(b)            → a != b   \r\n\r\na.compareTo(b)          → a <=> b  \r\na.compareTo(b) < 0      → a < b    \r\na.compareTo(b) <= 0     → a <= b   \r\na.compareTo(b) == 0     → a == b   \r\na.compareTo(b) != 0     → a != b   \r\na.compareTo(b) >= 0     → a >= b   \r\na.compareTo(b) > 0      → a > b    \r\n\r\na.getAt(b)              → a[b]     \r\na.putAt(b, c)           → a[b] = c \r\n```","created_at":"2015-10-22T18:00:11Z","updated_at":"2016-03-24T16:59:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1334a63bb603433081515c533f709be7193a9e3f","assignee":{"login":"dovchinnikov","id":5519549,"avatar_url":"https://avatars.githubusercontent.com/u/5519549?v=3","gravatar_id":"","url":"https://api.github.com/users/dovchinnikov","html_url":"https://github.com/dovchinnikov","followers_url":"https://api.github.com/users/dovchinnikov/followers","following_url":"https://api.github.com/users/dovchinnikov/following{/other_user}","gists_url":"https://api.github.com/users/dovchinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/dovchinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dovchinnikov/subscriptions","organizations_url":"https://api.github.com/users/dovchinnikov/orgs","repos_url":"https://api.github.com/users/dovchinnikov/repos","events_url":"https://api.github.com/users/dovchinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/dovchinnikov/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311/commits","review_comments_url":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311/comments","review_comment_url":"https://api.github.com/repos/JetBrains/intellij-community/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JetBrains/intellij-community/issues/311/comments","statuses_url":"https://api.github.com/repos/JetBrains/intellij-community/statuses/ed6338e645524adbb0525f0e83d613e192b8454e","head":{"label":"paplorinc:convertToOperator","ref":"convertToOperator","sha":"ed6338e645524adbb0525f0e83d613e192b8454e","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"repo":{"id":31250684,"name":"intellij-community","full_name":"paplorinc/intellij-community","owner":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paplorinc/intellij-community","description":"IntelliJ IDEA Community Edition","fork":true,"url":"https://api.github.com/repos/paplorinc/intellij-community","forks_url":"https://api.github.com/repos/paplorinc/intellij-community/forks","keys_url":"https://api.github.com/repos/paplorinc/intellij-community/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paplorinc/intellij-community/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paplorinc/intellij-community/teams","hooks_url":"https://api.github.com/repos/paplorinc/intellij-community/hooks","issue_events_url":"https://api.github.com/repos/paplorinc/intellij-community/issues/events{/number}","events_url":"https://api.github.com/repos/paplorinc/intellij-community/events","assignees_url":"https://api.github.com/repos/paplorinc/intellij-community/assignees{/user}","branches_url":"https://api.github.com/repos/paplorinc/intellij-community/branches{/branch}","tags_url":"https://api.github.com/repos/paplorinc/intellij-community/tags","blobs_url":"https://api.github.com/repos/paplorinc/intellij-community/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paplorinc/intellij-community/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paplorinc/intellij-community/git/refs{/sha}","trees_url":"https://api.github.com/repos/paplorinc/intellij-community/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paplorinc/intellij-community/statuses/{sha}","languages_url":"https://api.github.com/repos/paplorinc/intellij-community/languages","stargazers_url":"https://api.github.com/repos/paplorinc/intellij-community/stargazers","contributors_url":"https://api.github.com/repos/paplorinc/intellij-community/contributors","subscribers_url":"https://api.github.com/repos/paplorinc/intellij-community/subscribers","subscription_url":"https://api.github.com/repos/paplorinc/intellij-community/subscription","commits_url":"https://api.github.com/repos/paplorinc/intellij-community/commits{/sha}","git_commits_url":"https://api.github.com/repos/paplorinc/intellij-community/git/commits{/sha}","comments_url":"https://api.github.com/repos/paplorinc/intellij-community/comments{/number}","issue_comment_url":"https://api.github.com/repos/paplorinc/intellij-community/issues/comments{/number}","contents_url":"https://api.github.com/repos/paplorinc/intellij-community/contents/{+path}","compare_url":"https://api.github.com/repos/paplorinc/intellij-community/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paplorinc/intellij-community/merges","archive_url":"https://api.github.com/repos/paplorinc/intellij-community/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paplorinc/intellij-community/downloads","issues_url":"https://api.github.com/repos/paplorinc/intellij-community/issues{/number}","pulls_url":"https://api.github.com/repos/paplorinc/intellij-community/pulls{/number}","milestones_url":"https://api.github.com/repos/paplorinc/intellij-community/milestones{/number}","notifications_url":"https://api.github.com/repos/paplorinc/intellij-community/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paplorinc/intellij-community/labels{/name}","releases_url":"https://api.github.com/repos/paplorinc/intellij-community/releases{/id}","deployments_url":"https://api.github.com/repos/paplorinc/intellij-community/deployments","created_at":"2015-02-24T08:19:00Z","updated_at":"2016-02-22T20:30:46Z","pushed_at":"2016-03-24T16:56:12Z","git_url":"git://github.com/paplorinc/intellij-community.git","ssh_url":"git@github.com:paplorinc/intellij-community.git","clone_url":"https://github.com/paplorinc/intellij-community.git","svn_url":"https://github.com/paplorinc/intellij-community","homepage":"http://www.jetbrains.com/idea/","size":2241850,"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":"JetBrains:master","ref":"master","sha":"b6be69e4a910dcab4898a3df1145e4a0aea1f6d6","user":{"login":"JetBrains","id":878437,"avatar_url":"https://avatars.githubusercontent.com/u/878437?v=3","gravatar_id":"","url":"https://api.github.com/users/JetBrains","html_url":"https://github.com/JetBrains","followers_url":"https://api.github.com/users/JetBrains/followers","following_url":"https://api.github.com/users/JetBrains/following{/other_user}","gists_url":"https://api.github.com/users/JetBrains/gists{/gist_id}","starred_url":"https://api.github.com/users/JetBrains/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JetBrains/subscriptions","organizations_url":"https://api.github.com/users/JetBrains/orgs","repos_url":"https://api.github.com/users/JetBrains/repos","events_url":"https://api.github.com/users/JetBrains/events{/privacy}","received_events_url":"https://api.github.com/users/JetBrains/received_events","type":"Organization","site_admin":false},"repo":{"id":2489216,"name":"intellij-community","full_name":"JetBrains/intellij-community","owner":{"login":"JetBrains","id":878437,"avatar_url":"https://avatars.githubusercontent.com/u/878437?v=3","gravatar_id":"","url":"https://api.github.com/users/JetBrains","html_url":"https://github.com/JetBrains","followers_url":"https://api.github.com/users/JetBrains/followers","following_url":"https://api.github.com/users/JetBrains/following{/other_user}","gists_url":"https://api.github.com/users/JetBrains/gists{/gist_id}","starred_url":"https://api.github.com/users/JetBrains/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JetBrains/subscriptions","organizations_url":"https://api.github.com/users/JetBrains/orgs","repos_url":"https://api.github.com/users/JetBrains/repos","events_url":"https://api.github.com/users/JetBrains/events{/privacy}","received_events_url":"https://api.github.com/users/JetBrains/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JetBrains/intellij-community","description":"IntelliJ IDEA Community Edition","fork":false,"url":"https://api.github.com/repos/JetBrains/intellij-community","forks_url":"https://api.github.com/repos/JetBrains/intellij-community/forks","keys_url":"https://api.github.com/repos/JetBrains/intellij-community/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JetBrains/intellij-community/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JetBrains/intellij-community/teams","hooks_url":"https://api.github.com/repos/JetBrains/intellij-community/hooks","issue_events_url":"https://api.github.com/repos/JetBrains/intellij-community/issues/events{/number}","events_url":"https://api.github.com/repos/JetBrains/intellij-community/events","assignees_url":"https://api.github.com/repos/JetBrains/intellij-community/assignees{/user}","branches_url":"https://api.github.com/repos/JetBrains/intellij-community/branches{/branch}","tags_url":"https://api.github.com/repos/JetBrains/intellij-community/tags","blobs_url":"https://api.github.com/repos/JetBrains/intellij-community/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JetBrains/intellij-community/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JetBrains/intellij-community/git/refs{/sha}","trees_url":"https://api.github.com/repos/JetBrains/intellij-community/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JetBrains/intellij-community/statuses/{sha}","languages_url":"https://api.github.com/repos/JetBrains/intellij-community/languages","stargazers_url":"https://api.github.com/repos/JetBrains/intellij-community/stargazers","contributors_url":"https://api.github.com/repos/JetBrains/intellij-community/contributors","subscribers_url":"https://api.github.com/repos/JetBrains/intellij-community/subscribers","subscription_url":"https://api.github.com/repos/JetBrains/intellij-community/subscription","commits_url":"https://api.github.com/repos/JetBrains/intellij-community/commits{/sha}","git_commits_url":"https://api.github.com/repos/JetBrains/intellij-community/git/commits{/sha}","comments_url":"https://api.github.com/repos/JetBrains/intellij-community/comments{/number}","issue_comment_url":"https://api.github.com/repos/JetBrains/intellij-community/issues/comments{/number}","contents_url":"https://api.github.com/repos/JetBrains/intellij-community/contents/{+path}","compare_url":"https://api.github.com/repos/JetBrains/intellij-community/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JetBrains/intellij-community/merges","archive_url":"https://api.github.com/repos/JetBrains/intellij-community/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JetBrains/intellij-community/downloads","issues_url":"https://api.github.com/repos/JetBrains/intellij-community/issues{/number}","pulls_url":"https://api.github.com/repos/JetBrains/intellij-community/pulls{/number}","milestones_url":"https://api.github.com/repos/JetBrains/intellij-community/milestones{/number}","notifications_url":"https://api.github.com/repos/JetBrains/intellij-community/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JetBrains/intellij-community/labels{/name}","releases_url":"https://api.github.com/repos/JetBrains/intellij-community/releases{/id}","deployments_url":"https://api.github.com/repos/JetBrains/intellij-community/deployments","created_at":"2011-09-30T13:33:05Z","updated_at":"2016-03-24T14:07:23Z","pushed_at":"2016-03-24T16:56:19Z","git_url":"git://github.com/JetBrains/intellij-community.git","ssh_url":"git@github.com:JetBrains/intellij-community.git","clone_url":"https://github.com/JetBrains/intellij-community.git","svn_url":"https://github.com/JetBrains/intellij-community","homepage":"http://www.jetbrains.com/idea/","size":2249146,"stargazers_count":2821,"watchers_count":2821,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1232,"mirror_url":null,"open_issues_count":71,"forks":1232,"open_issues":71,"watchers":2821,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311"},"html":{"href":"https://github.com/JetBrains/intellij-community/pull/311"},"issue":{"href":"https://api.github.com/repos/JetBrains/intellij-community/issues/311"},"comments":{"href":"https://api.github.com/repos/JetBrains/intellij-community/issues/311/comments"},"review_comments":{"href":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311/comments"},"review_comment":{"href":"https://api.github.com/repos/JetBrains/intellij-community/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JetBrains/intellij-community/pulls/311/commits"},"statuses":{"href":"https://api.github.com/repos/JetBrains/intellij-community/statuses/ed6338e645524adbb0525f0e83d613e192b8454e"}}}}