-
Notifications
You must be signed in to change notification settings - Fork 21
java generic signature of a class should not refer to type parameters of an enclosing method #3249
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3249?orig=1 |
@paulp said: % cat a.scala
object A { def f[T] = (x: T) => 5 }
% scalac a.scala
% javac -cp .:scala-library.jar -Xprint 'A$$' public final class A$$ implements scala.ScalaObject {
public static final A$$ MODULE$$;
public <T> scala.Function1<T,java.lang.Integer> f();
private A$$();
}
% javac -cp .:scala-library.jar -Xprint 'A'
error: cannot access A.$$anonfun$$f$$1
bad class file: ./A$$$$anonfun$$f$$1.class
undeclared type variable: T
Please remove or make sure it appears in the correct subdirectory of the classpath.
1 error |
@adriaanm said: // a.scala
class A[U] { def f[T] = { class X extends A[T] } }
/*
$$ scalac a.scala
$$ javac -cp .:$$SCALA_HOME/lib/scala-library.jar -Xprint 'A$$X$$1'
public class X$$1 extends A</*OHNOES where is T!1?*/> implements scala.ScalaObject {
public X$$1();
}
*/ |
@adriaanm said: for this example, and class $$ scalac a.scala
$$ javac -cp .:$$SCALA_HOME/lib/scala-library.jar -Xprint 'A$$X$$1'
public class X$$1 extends A<java.lang.Object> implements scala.ScalaObject {
public X$$1(A<U> null);
} |
javac -cp experimental/users/mahler/scala/scala-2.8.0.r22830-b20100824020153/lib/scala-library.jar -Xprint scala.actors.Actor error: cannot access scala.actors.Actor.$$anonfun$$respondOn$$1 bad class file: scala/actors/Actor$$$$anonfun$$respondOn$$1.class(scala/actors:Actor$$$$anonfun$$respondOn$$1.class) undeclared type variable: A Please remove or make sure it appears in the correct subdirectory of the classpath. 1 error |
@adriaanm said: |
Josh Suereth (joshua.suereth) said: |
Josh Suereth (joshua.suereth) said: class A[U] {
def bar[B >: U](x : => B) = x
def foo[C >: U](c : C) : C = bar(c)
} Leads to the ever-so-helpful message:
I tried reproducing without having the extra method and was unable to. Something about the generic method that is auto-lifting the closure for another generic method is bypassing the logic Adrian added. If you'd like me to some more investigated here, please let me know. |
@dragos said: |
@dragos said: |
I am using 2.8.0.r21010-b2010022802013
This problem affects all scala classiles I have tried.
It can be reproduced on the scala-library classes, eg:
I believe this needs to work in order to process java classfile annotations in scala classfiles (ie by using -processor instead of -Xprint)
The text was updated successfully, but these errors were encountered: