{"action":"created","issue":{"url":"https://api.github.com/repos/typetools/checker-framework/issues/511","labels_url":"https://api.github.com/repos/typetools/checker-framework/issues/511/labels{/name}","comments_url":"https://api.github.com/repos/typetools/checker-framework/issues/511/comments","events_url":"https://api.github.com/repos/typetools/checker-framework/issues/511/events","html_url":"https://github.com/typetools/checker-framework/issues/511","id":115951026,"number":511,"title":"Incorrect generic type inference for wildcards","user":{"login":"atomicknight","id":245116,"avatar_url":"https://avatars.githubusercontent.com/u/245116?v=3","gravatar_id":"","url":"https://api.github.com/users/atomicknight","html_url":"https://github.com/atomicknight","followers_url":"https://api.github.com/users/atomicknight/followers","following_url":"https://api.github.com/users/atomicknight/following{/other_user}","gists_url":"https://api.github.com/users/atomicknight/gists{/gist_id}","starred_url":"https://api.github.com/users/atomicknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atomicknight/subscriptions","organizations_url":"https://api.github.com/users/atomicknight/orgs","repos_url":"https://api.github.com/users/atomicknight/repos","events_url":"https://api.github.com/users/atomicknight/events{/privacy}","received_events_url":"https://api.github.com/users/atomicknight/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/typetools/checker-framework/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"smillst","id":13260174,"avatar_url":"https://avatars.githubusercontent.com/u/13260174?v=3","gravatar_id":"","url":"https://api.github.com/users/smillst","html_url":"https://github.com/smillst","followers_url":"https://api.github.com/users/smillst/followers","following_url":"https://api.github.com/users/smillst/following{/other_user}","gists_url":"https://api.github.com/users/smillst/gists{/gist_id}","starred_url":"https://api.github.com/users/smillst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillst/subscriptions","organizations_url":"https://api.github.com/users/smillst/orgs","repos_url":"https://api.github.com/users/smillst/repos","events_url":"https://api.github.com/users/smillst/events{/privacy}","received_events_url":"https://api.github.com/users/smillst/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/typetools/checker-framework/milestones/3","html_url":"https://github.com/typetools/checker-framework/milestones/High","labels_url":"https://api.github.com/repos/typetools/checker-framework/milestones/3/labels","id":1202755,"number":3,"title":"High","description":null,"creator":{"login":"mernst","id":121025,"avatar_url":"https://avatars.githubusercontent.com/u/121025?v=3","gravatar_id":"","url":"https://api.github.com/users/mernst","html_url":"https://github.com/mernst","followers_url":"https://api.github.com/users/mernst/followers","following_url":"https://api.github.com/users/mernst/following{/other_user}","gists_url":"https://api.github.com/users/mernst/gists{/gist_id}","starred_url":"https://api.github.com/users/mernst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mernst/subscriptions","organizations_url":"https://api.github.com/users/mernst/orgs","repos_url":"https://api.github.com/users/mernst/repos","events_url":"https://api.github.com/users/mernst/events{/privacy}","received_events_url":"https://api.github.com/users/mernst/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":2,"state":"open","created_at":"2015-07-10T16:55:58Z","updated_at":"2015-11-16T12:02:12Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-11-09T19:47:33Z","updated_at":"2015-11-24T18:49:40Z","closed_at":null,"body":"Environment: Checker Framework 1.9.7, Oracle JDK 1.8.0_65, Windows 7\r\n\r\nA third-party library (ANTLR) defines an API that uses wildcards in the method signature; users of the library override the method. The standard Oracle javac accepts this without issue. However, the Checker Framework raises an error, seemingly due to incorrect type inference for the wildcards.\r\n\r\nThe method signature looks like this:\r\n```java\r\nvoid syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)\r\n```\r\n\r\nThe error that is raised looks like this:\r\n```\r\n[override.param.invalid] void syntaxError(Test this, Recognizer<? extends Object, ? extends ATNSimulator> p0, Object p1, int p2, int p3, String p4, RecognitionException p5) in org.example.Test cannot override void syntaxError(ANTLRErrorListener this, Recognizer<? extends Object, ? extends Object> p0, Object p1, int p2, int p3, String p4, RecognitionException p5)\r\n```\r\nNote the incorrect bound for the second type parameter of Recognizer.\r\n\r\nThe full test case (Maven build - just execute `mvn`): https://github.com/atomicknight/cf-testcases/tree/master/genericwildcardinheritance1"},"comment":{"url":"https://api.github.com/repos/typetools/checker-framework/issues/comments/159369914","html_url":"https://github.com/typetools/checker-framework/issues/511#issuecomment-159369914","issue_url":"https://api.github.com/repos/typetools/checker-framework/issues/511","id":159369914,"user":{"login":"smillst","id":13260174,"avatar_url":"https://avatars.githubusercontent.com/u/13260174?v=3","gravatar_id":"","url":"https://api.github.com/users/smillst","html_url":"https://github.com/smillst","followers_url":"https://api.github.com/users/smillst/followers","following_url":"https://api.github.com/users/smillst/following{/other_user}","gists_url":"https://api.github.com/users/smillst/gists{/gist_id}","starred_url":"https://api.github.com/users/smillst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillst/subscriptions","organizations_url":"https://api.github.com/users/smillst/orgs","repos_url":"https://api.github.com/users/smillst/repos","events_url":"https://api.github.com/users/smillst/events{/privacy}","received_events_url":"https://api.github.com/users/smillst/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T18:49:40Z","updated_at":"2015-11-24T18:49:40Z","body":"The issue here is that the Checker Framework does not support wildcards that are outside of the bounds of the type variable.  For example:\r\n```\r\nclass MyGeneric<T extends Object>{}\r\nclass Use{\r\n   MyGeneric<? extends  Object> wildCardExtendsObject;\r\n   MyGeneric<? extends Number> wildCardExtendsNumber = wildCardExtendsObject;\r\n}\r\n```\r\nResults in this error:\r\n```\r\n:4: error: [assignment.type.incompatible] incompatible types in assignment.\r\n    MyGeneric<? extends Number> wildCardExtendsNumber = wildCardExtendsObject;\r\n                                                        ^\r\n  found   : MyGeneric<? extends Object>\r\n  required: MyGeneric<? extends Number>\r\n```\r\nHowever, this assignment is legal because the type of wildCardExtendsObject in javac is:\r\n    CAP#1 extends Number from capture of ? extends Object\r\nSo this assignment is legal. \r\n\r\n\r\n\r\n"}}