{"action":"opened","issue":{"url":"https://api.github.com/repos/scala/bug/issues/10260","repository_url":"https://api.github.com/repos/scala/bug","labels_url":"https://api.github.com/repos/scala/bug/issues/10260/labels{/name}","comments_url":"https://api.github.com/repos/scala/bug/issues/10260/comments","events_url":"https://api.github.com/repos/scala/bug/issues/10260/events","html_url":"https://github.com/scala/bug/issues/10260","id":220994315,"number":10260,"title":"Incorrect compiler error message overriding java raw type with a recursive type bound","user":{"login":"jeantil","id":22979,"avatar_url":"https://avatars0.githubusercontent.com/u/22979?v=3","gravatar_id":"","url":"https://api.github.com/users/jeantil","html_url":"https://github.com/jeantil","followers_url":"https://api.github.com/users/jeantil/followers","following_url":"https://api.github.com/users/jeantil/following{/other_user}","gists_url":"https://api.github.com/users/jeantil/gists{/gist_id}","starred_url":"https://api.github.com/users/jeantil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeantil/subscriptions","organizations_url":"https://api.github.com/users/jeantil/orgs","repos_url":"https://api.github.com/users/jeantil/repos","events_url":"https://api.github.com/users/jeantil/events{/privacy}","received_events_url":"https://api.github.com/users/jeantil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-11T15:40:14Z","updated_at":"2017-04-11T15:40:14Z","closed_at":null,"body":"Given the following java code: \r\n```\r\npublic class A<T extends A<T>> {}\r\ninterface IA {\r\n    void foo(A a);\r\n}\r\n```\r\nwhen trying to implement the interface from scala with \r\n```\r\nclass IAImpl extends IA{\r\n  override def foo(a: A[_]): Unit = ???\r\n}\r\n```\r\nthen the scala compiler (2.10.6, 2.11.8, 2.12.1) fails with the following message: \r\n```\r\nclass IAImpl needs to be abstract, since method foo in trait IA of type (a: A)Unit is not defined\r\n(Note that A does not match A[_]. To implement a raw type, use A[_])\r\nclass IAImpl extends IA{\r\n      ^\r\n```\r\nWhich is fairly confusing since the recommendation is the same as the actual error. \r\n\r\nAfter discussing this on the [scala user's board](https://users.scala-lang.org/t/java-raw-types-and-recursive-type-bounds/349) it appears the correct syntax to override such a method is \r\n\r\n```\r\nclass IAImpl extends IA { \r\n  override def foo(a: A[X] forSome {type X <: A[X]}): Unit = ??? \r\n}\r\n```\r\n\r\nMaybe the compiler could detect that and print a better error message ?"}}
{"actor":{"display_login":"jeantil"}}