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

2.9 regression: can't use scala.collection.immutable.List from Java #4291

Closed
scabug opened this issue Feb 23, 2011 · 6 comments
Closed

2.9 regression: can't use scala.collection.immutable.List from Java #4291

scabug opened this issue Feb 23, 2011 · 6 comments

Comments

@scabug
Copy link

scabug commented Feb 23, 2011

as of r24330:

  ~> cat S.scala                                                                                                
class S { val b = List("foo") }
  ~> cat J.java
class J { String s = (new S()).b().apply(0); }
  ~> rm *.class                                                                              
  ~> /usr/local/scala-2.8.1.final/bin/scalac S.scala                                         
  ~> javac -classpath .:/usr/local/scala-2.8.1.final/lib/scala-library.jar J.java            
  ~> rm *.class
  ~> ~/scala/dists/scala-2.9.0.r24330-b20110222144825/bin/scalac S.scala                     
  ~> javac -classpath .:/Users/tisue/scala/dists/scala-2.9.0.r24330-b20110222144825/lib/scala-library.jar J.java
J.java:1: incompatible types
found   : java.lang.Object
required: java.lang.String
class J { String s = (new S()).b().apply(0); }
                                        ^
1 error

possibly related: #4238

@scabug
Copy link
Author

scabug commented Feb 23, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4291?orig=1
Reporter: @SethTisue

@scabug
Copy link
Author

scabug commented Feb 23, 2011

@paulp said:
Regression, concretely:

% scala29 -nocompdaemon -e 'println(classOf[List[_]].getMethods filter (_.getName == "apply") map (_.getGenericReturnType) mkString ", ")'
class java.lang.Object, class java.lang.Object
% scala281 -nocompdaemon -e 'println(classOf[List[_]].getMethods filter (_.getName == "apply") map (_.getGenericReturnType) mkString ", ")'
A, class java.lang.Object  

"A" of course being what you want, List's type parameter.

@scabug
Copy link
Author

scabug commented Feb 23, 2011

@paulp said:
Must be caused by r24319 I think. Still working in r24314, busted in r24323. I'm supposed to be looking at that and making sure it's not breaking anything anyway.

@scabug
Copy link
Author

scabug commented Feb 24, 2011

@SethTisue said:
this appears to be another manifestation of the same issue:

  ~> cat S.scala
trait T { def f: Option[String] = None }
class S extends T
  ~> cat J.java
class J extends S { }
  ~> /usr/local/scala-2.8.1.final/bin/scalac S.scala                             
  ~> javac -classpath .:/usr/local/scala-2.8.1.final/lib/scala-library.jar J.java
  ~> rm *.class
  ~> ~/scala/dists/scala-2.9.0.r24330-b20110222144825/bin/scalac S.scala
  ~> javac -Xlint:unchecked -classpath :/Users/tisue/scala/dists/scala-2.9.0.r24330-b20110222144825/lib/scala-library.jar J.java
J.java:1: warning: f() in S implements f() in T; return type requires unchecked conversion
found   : scala.Option
required: scala.Option<java.lang.String>
class J extends S { }
^
1 warning

@scabug
Copy link
Author

scabug commented Feb 24, 2011

@paulp said:
Thanks for catching this so quickly: it makes a huge difference.

@scabug
Copy link
Author

scabug commented Feb 24, 2011

@paulp said:
(In r24344) Reversion of r24319 for causing #4291. Test case to fence out #4291
in future attempts. Closes #4291, references #4214, no review.

@scabug scabug closed this as completed May 18, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant