{"action":"created","issue":{"url":"https://api.github.com/repos/mebigfatguy/fb-contrib/issues/282","repository_url":"https://api.github.com/repos/mebigfatguy/fb-contrib","labels_url":"https://api.github.com/repos/mebigfatguy/fb-contrib/issues/282/labels{/name}","comments_url":"https://api.github.com/repos/mebigfatguy/fb-contrib/issues/282/comments","events_url":"https://api.github.com/repos/mebigfatguy/fb-contrib/issues/282/events","html_url":"https://github.com/mebigfatguy/fb-contrib/issues/282","id":322539845,"number":282,"title":"FII_USE_METHOD_REFERENCE false positives","user":{"login":"boris-petrov","id":278940,"avatar_url":"https://avatars3.githubusercontent.com/u/278940?v=4","gravatar_id":"","url":"https://api.github.com/users/boris-petrov","html_url":"https://github.com/boris-petrov","followers_url":"https://api.github.com/users/boris-petrov/followers","following_url":"https://api.github.com/users/boris-petrov/following{/other_user}","gists_url":"https://api.github.com/users/boris-petrov/gists{/gist_id}","starred_url":"https://api.github.com/users/boris-petrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boris-petrov/subscriptions","organizations_url":"https://api.github.com/users/boris-petrov/orgs","repos_url":"https://api.github.com/users/boris-petrov/repos","events_url":"https://api.github.com/users/boris-petrov/events{/privacy}","received_events_url":"https://api.github.com/users/boris-petrov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-12T20:15:17Z","updated_at":"2018-05-13T12:45:50Z","closed_at":null,"author_association":"NONE","body":"This gives the warning:\r\n\r\n```java\r\nmap.computeIfAbsent(\"key\", _unused -> object.getValue());\r\n```\r\n\r\nWhich is wrong. Also this:\r\n\r\n```java\r\nImmutableMap.Builder<Object, ImmutableList.Builder<Object>> bar =\r\n\tImmutableMap.builder();\r\n\r\nIImmutableMap<Object, IImmutableList<Object>> foo =\r\n\tbar.map(builder -> (IImmutableList<Object>) builder.build()).build();\r\n```\r\n\r\nIn the second line, in the lambda, the code `builder.build()` returns an `ImmutableList<Object>` rather than an `IImmutableList<Object>` and hence removing the cast makes the code not compile. The cast is needed and therefore this lambda cannot be made a method-reference.\r\n\r\nP.S. You can imagine some implementations for `class Immutable*` and `interface IImmutable*`."},"comment":{"url":"https://api.github.com/repos/mebigfatguy/fb-contrib/issues/comments/388624337","html_url":"https://github.com/mebigfatguy/fb-contrib/issues/282#issuecomment-388624337","issue_url":"https://api.github.com/repos/mebigfatguy/fb-contrib/issues/282","id":388624337,"user":{"login":"mebigfatguy","id":170161,"avatar_url":"https://avatars1.githubusercontent.com/u/170161?v=4","gravatar_id":"","url":"https://api.github.com/users/mebigfatguy","html_url":"https://github.com/mebigfatguy","followers_url":"https://api.github.com/users/mebigfatguy/followers","following_url":"https://api.github.com/users/mebigfatguy/following{/other_user}","gists_url":"https://api.github.com/users/mebigfatguy/gists{/gist_id}","starred_url":"https://api.github.com/users/mebigfatguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mebigfatguy/subscriptions","organizations_url":"https://api.github.com/users/mebigfatguy/orgs","repos_url":"https://api.github.com/users/mebigfatguy/repos","events_url":"https://api.github.com/users/mebigfatguy/events{/privacy}","received_events_url":"https://api.github.com/users/mebigfatguy/received_events","type":"User","site_admin":false},"created_at":"2018-05-13T12:45:50Z","updated_at":"2018-05-13T12:45:50Z","author_association":"OWNER","body":"Thanks!\r\n\r\nthat's an interesting case, i'm not sure why the cast is necessary, as in the generated code no cast is produced\r\n\r\n  private static IImmutableList lambda$testBB$0(ImmutableList$Builder);\r\n    descriptor: (LImmutableList$Builder;)LIImmutableList;\r\n    flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC\r\n    Code:\r\n      stack=1, locals=1, args_size=1\r\n         0: aload_0\r\n         1: invokevirtual #6                  // Method ImmutableList$Builder.build:()LImmutableList;\r\n         4: areturn\r\n      LineNumberTable:\r\n        line 8: 0\r\n"}}
{"actor":{"display_login":"mebigfatguy"}}