Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InnerClass entry should added to class file for references in Java Generic Signatures #10180

Closed
scabug opened this issue Feb 11, 2017 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 11, 2017

Related to #9937, in which the same bug in Kotlin trips up scalac.

$ cat sandbox/test.scala && scalac sandbox/test.scala
class C {
  class D
}

abstract class E { def foo: Option[C#D] }

$ javap -cp . -v E | tail -n 30
  #25 = Utf8               ScalaSig
{
  public abstract scala.Option<C$D> foo();
    descriptor: ()Lscala/Option;
    flags: ACC_PUBLIC, ACC_ABSTRACT
    Signature: #18                          // ()Lscala/Option<LC$D;>;

  public E();
    descriptor: ()V
    flags: ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #14                 // Method java/lang/Object."<init>":()V
         4: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       5     0  this   LE;
      LineNumberTable:
        line 5: 0
}
SourceFile: "test.scala"
RuntimeVisibleAnnotations:
  0: #6(#7=s#8)
Error: unknown attribute
  ScalaInlineInfo: length = 0xE
   01 00 00 02 00 0B 00 0C 00 00 09 00 0A 00
Error: unknown attribute
  ScalaSig: length = 0x3
   05 00 00

Compare with Java:

$ cat sandbox/Test.java && javac -d . sandbox/Test.java
class C { class D {} }
abstract class E { abstract java.util.List<C.D> foo(); }

$ javap -cp . -v E | tail -n 5
    Signature: #14                          // ()Ljava/util/List<LC$D;>;
}
SourceFile: "Test.java"
InnerClasses:
     #12= #11 of #20; //D=class C$D of class C

@scabug
Copy link
Author

scabug commented Feb 11, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10180?orig=1
Reporter: @retronym
Affected Versions: 2.11.8, 2.12.1
See #9937

@scabug
Copy link
Author

scabug commented Feb 11, 2017

@lrytz
Copy link
Member

lrytz commented May 29, 2017

akka.persistence.AbstractPersistentActorWithAtLeastOnceDelivery inherits private var unconfirmed = immutable.SortedMap.empty[Long, Delivery] where Delivery is an inner class, the attribute is missing. See #10341.

@lrytz lrytz assigned lrytz and unassigned retronym May 31, 2017
lrytz added a commit to lrytz/scala that referenced this issue Jun 1, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
lrytz added a commit to lrytz/scala that referenced this issue Jun 1, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
@lrytz
Copy link
Member

lrytz commented Jun 1, 2017

Fix in scala/scala#5925. Created a new ticket #10348 for the fact that the signature is ()Lscala/Option<LC$D;>;, while it should be ()Lscala/Option<LC.D;>;

@lrytz
Copy link
Member

lrytz commented Jun 1, 2017

Oh, javac's signature is actually also ()Ljava/util/List<LC$D;>;, so maybe there's no issue there.

lrytz added a commit to lrytz/scala that referenced this issue Jun 1, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
lrytz added a commit to lrytz/scala that referenced this issue Jun 1, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
lrytz added a commit to lrytz/scala that referenced this issue Jun 2, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
lrytz added a commit to lrytz/scala that referenced this issue Jun 2, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
lrytz added a commit to lrytz/scala that referenced this issue Jun 2, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
@lrytz
Copy link
Member

lrytz commented Jun 3, 2017

Earlier PR: scala/scala#5690

@lrytz lrytz added the has PR label Jun 14, 2017
lrytz added a commit to lrytz/scala that referenced this issue Jun 15, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
lrytz added a commit to lrytz/scala that referenced this issue Jun 15, 2017
To emit the InnerClass table we visit ClassNodes after all code
generation is done. This is simpler than keeping track of things
during code generation and the optimizer.

Until now we didn't include references to nested classes that
appear only in generic signatures.

Fixes scala/bug#10180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants