{"action":"opened","issue":{"url":"https://api.github.com/repos/scala/bug/issues/10889","repository_url":"https://api.github.com/repos/scala/bug","labels_url":"https://api.github.com/repos/scala/bug/issues/10889/labels{/name}","comments_url":"https://api.github.com/repos/scala/bug/issues/10889/comments","events_url":"https://api.github.com/repos/scala/bug/issues/10889/events","html_url":"https://github.com/scala/bug/issues/10889","id":324009543,"number":10889,"title":"Nested generic class requires explicit outer paramter when used from Java","user":{"login":"lrytz","id":119636,"avatar_url":"https://avatars1.githubusercontent.com/u/119636?v=4","gravatar_id":"","url":"https://api.github.com/users/lrytz","html_url":"https://github.com/lrytz","followers_url":"https://api.github.com/users/lrytz/followers","following_url":"https://api.github.com/users/lrytz/following{/other_user}","gists_url":"https://api.github.com/users/lrytz/gists{/gist_id}","starred_url":"https://api.github.com/users/lrytz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrytz/subscriptions","organizations_url":"https://api.github.com/users/lrytz/orgs","repos_url":"https://api.github.com/users/lrytz/repos","events_url":"https://api.github.com/users/lrytz/events{/privacy}","received_events_url":"https://api.github.com/users/lrytz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-17T12:52:43Z","updated_at":"2018-05-17T12:52:43Z","closed_at":null,"author_association":"MEMBER","body":"```\r\n➜  o cat Test.scala\r\npackage p\r\nabstract class O {\r\n  class I[T](s: String)\r\n}\r\n➜  o scalac Test.scala\r\n```\r\n\r\n```\r\n➜  o cat Test.java\r\npublic class Test {\r\n  public void foo() {\r\n    p.O l = null;\r\n    p.O.I<Object> s = l.new I<Object>(/*l,*/ \"foo\");\r\n  }\r\n}\r\n➜  o javac Test.java\r\nTest.java:4: error: constructor I in class O.I<T> cannot be applied to given types;\r\n    p.O.I<Object> s = l.new I<Object>(/*l,*/ \"foo\");\r\n                        ^\r\n  required: O,String\r\n  found: String\r\n  reason: actual and formal argument lists differ in length\r\n  where T is a type-variable:\r\n    T extends Object declared in class O.I\r\n1 error\r\n```\r\n\r\nIt compiles when un-commenting the `l` constructor argument.\r\n\r\nIf we define O in Java:\r\n```\r\n➜  o cat O.java\r\npackage p;\r\npublic abstract class O {\r\n  public class I<T> {\r\n    public I(String s) { }\r\n  }\r\n}\r\n➜  o javac -d . O.java\r\n➜  o javac Test.java\r\n```\r\n\r\nIt seems the fact that we emit a generic signature is tripping up javac.\r\n\r\nClassfile from Scala\r\n```\r\n// class version 52.0 (52)\r\n// access flags 0x21\r\n// signature <T:Ljava/lang/Object;>Ljava/lang/Object;\r\n// declaration: p/O$I<T>\r\npublic class p/O$I {\r\n\r\n  // compiled from: Test.scala\r\n\r\n  ATTRIBUTE Scala : unknown\r\n\r\n  ATTRIBUTE ScalaInlineInfo : unknown\r\n  // access flags 0x1\r\n  public INNERCLASS p/O$I p/O I\r\n\r\n  // access flags 0x1011\r\n  public final synthetic Lp/O; $outer\r\n\r\n  // access flags 0x1001\r\n  public synthetic p$O$I$$$outer()Lp/O;\r\n\r\n  // access flags 0x1\r\n  // signature (Lp/O;Ljava/lang/String;)V\r\n  // declaration: void <init>(p.O, java.lang.String)\r\n  public <init>(Lp/O;Ljava/lang/String;)V\r\n}\r\n```\r\n\r\n\r\nClassfile from Java\r\n\r\n```\r\n// class version 52.0 (52)\r\n// access flags 0x21\r\n// signature <T:Ljava/lang/Object;>Ljava/lang/Object;\r\n// declaration: p/O$I<T>\r\npublic class p/O$I {\r\n\r\n  // compiled from: O.java\r\n  // access flags 0x1\r\n  public INNERCLASS p/O$I p/O I\r\n\r\n  // access flags 0x1010\r\n  final synthetic Lp/O; this$0\r\n\r\n  // access flags 0x1\r\n  public <init>(Lp/O;Ljava/lang/String;)V\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"lrytz"}}