Skip to content

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

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

Closed
smarter opened this issue Jun 2, 2016 · 2 comments
Closed

Comments

@smarter
Copy link
Member

smarter commented Jun 2, 2016

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).

smarter added a commit to dotty-staging/dotty that referenced this issue Jun 2, 2016
Currently, the classfiles emitted by dotty do not contain the type
parameters information that javac relies on.

Fixing this is tracked by scala#1303.
felixmulder pushed a commit to dotty-staging/dotty that referenced this issue Jun 3, 2016
Currently, the classfiles emitted by dotty do not contain the type
parameters information that javac relies on.

Fixing this is tracked by scala#1303.
@DarkDimius
Copy link
Contributor

In order to fix this bug one needs to implement getGenericSignature and getStaticForwarderGenericSignature in DottyBackendInterface.

odersky pushed a commit to odersky/dotty that referenced this issue Jul 27, 2016
Currently, the classfiles emitted by dotty do not contain the type
parameters information that javac relies on.

Fixing this is tracked by scala#1303.
@smarter
Copy link
Member Author

smarter commented Jan 11, 2018

Fixed by #3234

@smarter smarter closed this as completed Jan 11, 2018
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

2 participants