{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments/31060505","id":31060505,"diff_hunk":"@@ -453,138 +433,97 @@ void registerAssignedSymbol(Symbol symbol) {\n     }\n   }\n \n-  public enum AbstractValue {\n-    UNSET,\n-    // value is known to be not null.\n-    NOTNULL,\n-    // value is known to be null.\n-    NULL,\n-    // value is unknown (could be null or not null).\n-    UNKNOWN\n-  }\n-\n-  @VisibleForTesting\n-  static class ConditionalState {\n-    final State falseState;\n-    final State trueState;\n-\n-    ConditionalState(State currentState) {\n-      falseState = new State(currentState);\n-      trueState = new State(currentState);\n-    }\n-\n-    void mergeConditionalAnd(ConditionalState leftConditionalState, ConditionalState rightConditionalState) {\n-      // copies the learned values to the parent.\n-      trueState.copyValuesFrom(leftConditionalState.trueState);\n-      trueState.copyValuesFrom(rightConditionalState.trueState);\n-      // invalidates both false states and copies values to the parent\n-      falseState.copyValuesFrom(leftConditionalState.falseState.invalidateValues());\n-      falseState.copyValuesFrom(rightConditionalState.falseState.invalidateValues());\n-    }\n-\n-    void mergeConditionalOr(ConditionalState leftConditionalState, ConditionalState rightConditionalState) {\n-      // invalidates both true states and copies value to the parent.\n-      trueState.copyValuesFrom(leftConditionalState.trueState.invalidateValues());\n-      trueState.copyValuesFrom(rightConditionalState.trueState.invalidateValues());\n-      // copies the learned values to the parent.\n-      falseState.copyValuesFrom(leftConditionalState.falseState);\n-      falseState.copyValuesFrom(rightConditionalState.falseState);\n-    }\n-  }\n-\n-  @VisibleForTesting\n-  static class State {\n-    @Nullable\n-    final State parentState;\n-    final Map<VariableSymbol, AbstractValue> variables;\n-\n-    public State() {\n-      this.parentState = null;\n-      this.variables = new HashMap<>();\n-    }\n-\n-    public State(State parentState) {\n-      this.parentState = parentState;\n-      this.variables = new HashMap<>();\n+  public class NullPointerVisitor extends SymbolicExecutionCheck {\n+    @Override\n+    protected void onArrayAccess(ExecutionState executionState, ArrayAccessExpressionTree tree) {\n+      checkForIssue(tree.expression(), MESSAGE_NULLABLE_EXPRESSION, MESSAGE_NULL_LITERAL);\n     }\n \n-    // returns the value of the variable in the current state.\n-    public AbstractValue getVariableValue(VariableSymbol variable) {\n-      for (State state = this; state != null; state = state.parentState) {\n-        AbstractValue result = state.variables.get(variable);\n-        if (result != null) {\n-          return result;\n+    @Override\n+    protected void onExecutableElementInvocation(ExecutionState executionState, Tree tree, List<ExpressionTree> arguments) {\n+      if (tree.is(Tree.Kind.METHOD_INVOCATION)) {\n+        MethodInvocationTree methodInvocation = (MethodInvocationTree) tree;\n+        Symbol symbol = methodInvocation.symbol();\n+        if (symbol.isMethodSymbol()) {\n+          MethodJavaSymbol methodSymbol = (MethodJavaSymbol) symbol;\n+          List<JavaSymbol> parameters = methodSymbol.getParameters().scopeSymbols();\n+          if (!parameters.isEmpty()) {\n+            for (int i = 0; i < methodInvocation.arguments().size(); i += 1) {\n+              // in case of varargs, there could be more arguments than parameters. in that case, pick the last parameter.\n+              if (checkNullity(parameters.get(i < parameters.size() ? i : parameters.size() - 1)) == NullableState.NOTNULL) {","path":"java-checks/src/main/java/org/sonar/java/checks/NullPointerCheck.java","position":425,"original_position":425,"commit_id":"5fe821a26ca2e8e9a67d1a0b35b8c6e7738cef91","original_commit_id":"5fe821a26ca2e8e9a67d1a0b35b8c6e7738cef91","user":{"login":"SonarTech","id":1842438,"avatar_url":"https://avatars.githubusercontent.com/u/1842438?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarTech","html_url":"https://github.com/SonarTech","followers_url":"https://api.github.com/users/SonarTech/followers","following_url":"https://api.github.com/users/SonarTech/following{/other_user}","gists_url":"https://api.github.com/users/SonarTech/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarTech/subscriptions","organizations_url":"https://api.github.com/users/SonarTech/orgs","repos_url":"https://api.github.com/users/SonarTech/repos","events_url":"https://api.github.com/users/SonarTech/events{/privacy}","received_events_url":"https://api.github.com/users/SonarTech/received_events","type":"User","site_admin":false},"body":"![New](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/new.png) ![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Change this comparison to use the equals method. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://nemo.sonarqube.org/coding_rules#rule_key=squid%3AS1698)\n![New](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/new.png) ![MINOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png) Refactor this code to not nest more than 4 if/for/while/switch/try statements. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://nemo.sonarqube.org/coding_rules#rule_key=squid%3AS134)\n","created_at":"2015-05-26T17:53:28Z","updated_at":"2015-05-26T17:53:28Z","html_url":"https://github.com/SonarSource/sonar-java/pull/239#discussion_r31060505","pull_request_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments/31060505"},"html":{"href":"https://github.com/SonarSource/sonar-java/pull/239#discussion_r31060505"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239","id":36227171,"html_url":"https://github.com/SonarSource/sonar-java/pull/239","diff_url":"https://github.com/SonarSource/sonar-java/pull/239.diff","patch_url":"https://github.com/SonarSource/sonar-java/pull/239.patch","issue_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/239","number":239,"state":"open","locked":false,"title":"SONARJAVA-1089 Migrate NullPointerCheck to SymbolicExecutionCheck (new API)","user":{"login":"merciesa","id":8008916,"avatar_url":"https://avatars.githubusercontent.com/u/8008916?v=3","gravatar_id":"","url":"https://api.github.com/users/merciesa","html_url":"https://github.com/merciesa","followers_url":"https://api.github.com/users/merciesa/followers","following_url":"https://api.github.com/users/merciesa/following{/other_user}","gists_url":"https://api.github.com/users/merciesa/gists{/gist_id}","starred_url":"https://api.github.com/users/merciesa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merciesa/subscriptions","organizations_url":"https://api.github.com/users/merciesa/orgs","repos_url":"https://api.github.com/users/merciesa/repos","events_url":"https://api.github.com/users/merciesa/events{/privacy}","received_events_url":"https://api.github.com/users/merciesa/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-26T17:43:10Z","updated_at":"2015-05-26T17:53:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7bf4ecb1004350ca6f49cc20c897124a822d40b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/239/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonar-java/statuses/5fe821a26ca2e8e9a67d1a0b35b8c6e7738cef91","head":{"label":"merciesa:SONARJAVA-1089","ref":"SONARJAVA-1089","sha":"5fe821a26ca2e8e9a67d1a0b35b8c6e7738cef91","user":{"login":"merciesa","id":8008916,"avatar_url":"https://avatars.githubusercontent.com/u/8008916?v=3","gravatar_id":"","url":"https://api.github.com/users/merciesa","html_url":"https://github.com/merciesa","followers_url":"https://api.github.com/users/merciesa/followers","following_url":"https://api.github.com/users/merciesa/following{/other_user}","gists_url":"https://api.github.com/users/merciesa/gists{/gist_id}","starred_url":"https://api.github.com/users/merciesa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merciesa/subscriptions","organizations_url":"https://api.github.com/users/merciesa/orgs","repos_url":"https://api.github.com/users/merciesa/repos","events_url":"https://api.github.com/users/merciesa/events{/privacy}","received_events_url":"https://api.github.com/users/merciesa/received_events","type":"User","site_admin":false},"repo":{"id":31966358,"name":"sonar-java","full_name":"merciesa/sonar-java","owner":{"login":"merciesa","id":8008916,"avatar_url":"https://avatars.githubusercontent.com/u/8008916?v=3","gravatar_id":"","url":"https://api.github.com/users/merciesa","html_url":"https://github.com/merciesa","followers_url":"https://api.github.com/users/merciesa/followers","following_url":"https://api.github.com/users/merciesa/following{/other_user}","gists_url":"https://api.github.com/users/merciesa/gists{/gist_id}","starred_url":"https://api.github.com/users/merciesa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merciesa/subscriptions","organizations_url":"https://api.github.com/users/merciesa/orgs","repos_url":"https://api.github.com/users/merciesa/repos","events_url":"https://api.github.com/users/merciesa/events{/privacy}","received_events_url":"https://api.github.com/users/merciesa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/merciesa/sonar-java","description":"","fork":true,"url":"https://api.github.com/repos/merciesa/sonar-java","forks_url":"https://api.github.com/repos/merciesa/sonar-java/forks","keys_url":"https://api.github.com/repos/merciesa/sonar-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/merciesa/sonar-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/merciesa/sonar-java/teams","hooks_url":"https://api.github.com/repos/merciesa/sonar-java/hooks","issue_events_url":"https://api.github.com/repos/merciesa/sonar-java/issues/events{/number}","events_url":"https://api.github.com/repos/merciesa/sonar-java/events","assignees_url":"https://api.github.com/repos/merciesa/sonar-java/assignees{/user}","branches_url":"https://api.github.com/repos/merciesa/sonar-java/branches{/branch}","tags_url":"https://api.github.com/repos/merciesa/sonar-java/tags","blobs_url":"https://api.github.com/repos/merciesa/sonar-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/merciesa/sonar-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/merciesa/sonar-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/merciesa/sonar-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/merciesa/sonar-java/statuses/{sha}","languages_url":"https://api.github.com/repos/merciesa/sonar-java/languages","stargazers_url":"https://api.github.com/repos/merciesa/sonar-java/stargazers","contributors_url":"https://api.github.com/repos/merciesa/sonar-java/contributors","subscribers_url":"https://api.github.com/repos/merciesa/sonar-java/subscribers","subscription_url":"https://api.github.com/repos/merciesa/sonar-java/subscription","commits_url":"https://api.github.com/repos/merciesa/sonar-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/merciesa/sonar-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/merciesa/sonar-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/merciesa/sonar-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/merciesa/sonar-java/contents/{+path}","compare_url":"https://api.github.com/repos/merciesa/sonar-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/merciesa/sonar-java/merges","archive_url":"https://api.github.com/repos/merciesa/sonar-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/merciesa/sonar-java/downloads","issues_url":"https://api.github.com/repos/merciesa/sonar-java/issues{/number}","pulls_url":"https://api.github.com/repos/merciesa/sonar-java/pulls{/number}","milestones_url":"https://api.github.com/repos/merciesa/sonar-java/milestones{/number}","notifications_url":"https://api.github.com/repos/merciesa/sonar-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/merciesa/sonar-java/labels{/name}","releases_url":"https://api.github.com/repos/merciesa/sonar-java/releases{/id}","created_at":"2015-03-10T15:51:38Z","updated_at":"2015-03-10T15:51:41Z","pushed_at":"2015-05-26T17:42:32Z","git_url":"git://github.com/merciesa/sonar-java.git","ssh_url":"git@github.com:merciesa/sonar-java.git","clone_url":"https://github.com/merciesa/sonar-java.git","svn_url":"https://github.com/merciesa/sonar-java","homepage":"","size":11503,"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":"SonarSource:master","ref":"master","sha":"94cd7af6d6623faf9c307ab653c878bd462850a2","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":5674787,"name":"sonar-java","full_name":"SonarSource/sonar-java","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonar-java","description":"","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-java","forks_url":"https://api.github.com/repos/SonarSource/sonar-java/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-java/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-java/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-java/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-java/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-java/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-java/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-java/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-java/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-java/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-java/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-java/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-java/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-java/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-java/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-java/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-java/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-java/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-java/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-java/releases{/id}","created_at":"2012-09-04T15:53:13Z","updated_at":"2015-05-26T14:44:29Z","pushed_at":"2015-05-26T17:43:10Z","git_url":"git://github.com/SonarSource/sonar-java.git","ssh_url":"git@github.com:SonarSource/sonar-java.git","clone_url":"https://github.com/SonarSource/sonar-java.git","svn_url":"https://github.com/SonarSource/sonar-java","homepage":"","size":33754,"stargazers_count":42,"watchers_count":42,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":7,"forks":80,"open_issues":7,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239"},"html":{"href":"https://github.com/SonarSource/sonar-java/pull/239"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonar-java/issues/239"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonar-java/issues/239/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/239/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonar-java/statuses/5fe821a26ca2e8e9a67d1a0b35b8c6e7738cef91"}}}}