{"action":"created","issue":{"url":"https://api.github.com/repos/spotbugs/spotbugs/issues/1001","repository_url":"https://api.github.com/repos/spotbugs/spotbugs","labels_url":"https://api.github.com/repos/spotbugs/spotbugs/issues/1001/labels{/name}","comments_url":"https://api.github.com/repos/spotbugs/spotbugs/issues/1001/comments","events_url":"https://api.github.com/repos/spotbugs/spotbugs/issues/1001/events","html_url":"https://github.com/spotbugs/spotbugs/issues/1001","id":481536996,"node_id":"MDU6SXNzdWU0ODE1MzY5OTY=","number":1001,"title":"false positive: NP_NONNULL_PARAM_VIOLATION on CompletableFuture.getNow(null)","user":{"login":"ylexus","id":6009806,"node_id":"MDQ6VXNlcjYwMDk4MDY=","avatar_url":"https://avatars0.githubusercontent.com/u/6009806?v=4","gravatar_id":"","url":"https://api.github.com/users/ylexus","html_url":"https://github.com/ylexus","followers_url":"https://api.github.com/users/ylexus/followers","following_url":"https://api.github.com/users/ylexus/following{/other_user}","gists_url":"https://api.github.com/users/ylexus/gists{/gist_id}","starred_url":"https://api.github.com/users/ylexus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ylexus/subscriptions","organizations_url":"https://api.github.com/users/ylexus/orgs","repos_url":"https://api.github.com/users/ylexus/repos","events_url":"https://api.github.com/users/ylexus/events{/privacy}","received_events_url":"https://api.github.com/users/ylexus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-08-16T10:01:52Z","updated_at":"2019-09-16T14:55:41Z","closed_at":null,"author_association":"NONE","body":"spotbugs-maven-plugin:3.1.9 reports an error on a valid CompletableFuture.getNow(null) call:\r\n```java\r\nimport org.junit.jupiter.api.Test;\r\n\r\nimport java.util.concurrent.CompletableFuture;\r\nimport java.util.concurrent.CompletionException;\r\n\r\nimport static org.junit.jupiter.api.Assertions.assertThrows;\r\n\r\nfinal class Github1001Test {\r\n    @Test\r\n    void name() {\r\n        CompletableFuture<Object> future = new CompletableFuture<>();\r\n        future.completeExceptionally(new RuntimeException(\"oops\"));\r\n        assertThrows(CompletionException.class, () -> future.getNow(null));\r\n    }\r\n}\r\n```\r\n```\r\n[ERROR] Null passed for non-null parameter of java.util.concurrent.CompletableFuture.getNow(Object) in <...> NP_NONNULL_PARAM_VIOLATION\r\n```\r\n\r\nUnrelated, but the suppression (@SuppressFBWarnings(\"NP_NONNULL_PARAM_VIOLATION\")) only works on class level in the example above, probably because the lambda is a static method on this class. Understandable, but very counter-intuitive."},"comment":{"url":"https://api.github.com/repos/spotbugs/spotbugs/issues/comments/531814766","html_url":"https://github.com/spotbugs/spotbugs/issues/1001#issuecomment-531814766","issue_url":"https://api.github.com/repos/spotbugs/spotbugs/issues/1001","id":531814766,"node_id":"MDEyOklzc3VlQ29tbWVudDUzMTgxNDc2Ng==","user":{"login":"ahubold","id":592918,"node_id":"MDQ6VXNlcjU5MjkxOA==","avatar_url":"https://avatars2.githubusercontent.com/u/592918?v=4","gravatar_id":"","url":"https://api.github.com/users/ahubold","html_url":"https://github.com/ahubold","followers_url":"https://api.github.com/users/ahubold/followers","following_url":"https://api.github.com/users/ahubold/following{/other_user}","gists_url":"https://api.github.com/users/ahubold/gists{/gist_id}","starred_url":"https://api.github.com/users/ahubold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahubold/subscriptions","organizations_url":"https://api.github.com/users/ahubold/orgs","repos_url":"https://api.github.com/users/ahubold/repos","events_url":"https://api.github.com/users/ahubold/events{/privacy}","received_events_url":"https://api.github.com/users/ahubold/received_events","type":"User","site_admin":false},"created_at":"2019-09-16T14:55:41Z","updated_at":"2019-09-16T14:55:41Z","author_association":"CONTRIBUTOR","body":"Same problem here. This one seems to be similar to #484 and DefaultNullnessAnnotations.java should be extended to allow null values for the getNow() method, similar to the fix for #484 in https://github.com/spotbugs/spotbugs/commit/ac93f80b53780be2d943b3ff286cb41da6f52560"}}
{"actor":{"display_login":"ahubold"}}