Skip to content

Emitted classfiles do not contain type parameter information used by javac #1303

Closed
@smarter

Description

@smarter
class Foo[A] {
  def foo[T](x: T) = x
}

Compiled with scalac:

public class Foo<A> {
  public <T> T foo(T);
    Code:
       0: aload_1
       1: areturn

  public Foo();
    Code:
       0: aload_0
       1: invokespecial #19                 // Method java/lang/Object."<init>":()V
       4: return
}

Compiled with dotty:

public class Foo {
  public Foo();
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: return

  public java.lang.Object foo(java.lang.Object);
    Code:
       0: aload_1
       1: areturn
}

The type parameters in the bytecode are used by javac, see tests/pending/pos/java-interop/t1263 and tests/pending/pos/java-interop/t1745 for examples (these tests are currently not run with javac even though they should, this is fixed by #1289 which moves them to pending until this is fixed).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions