Skip to content

2.9 regression: Java interop: in signature, primitive types become Object when generics are also present #4317

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
scabug opened this issue Mar 6, 2011 · 5 comments

Comments

@scabug
Copy link

scabug commented Mar 6, 2011

as of r24390:

  ~> scala/dists/latest/bin/scala -version
Scala code runner version 2.9.0.r24390-b20110306074150 -- Copyright 2002-2011, LAMP/EPFL
  ~> cat S.scala                                                      
object S { def foo(x: Class[_ <: AnyRef]) = 0 }
  ~> scala/dists/latest/bin/scalaC S.scala
  ~> cat J.java                                                         
class J {
	int bar() { return S.foo(String.class) ; }
}
  ~> javac -classpath .:scala/dists/latest/lib/scala-library.jar J.java
J.java:2: incompatible types
found   : java.lang.Object
required: int
	int bar() { return S.foo(String.class) ; }
	                        ^
1 error
@scabug
Copy link
Author

scabug commented Mar 6, 2011

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

@scabug
Copy link
Author

scabug commented Mar 6, 2011

@SethTisue said:
a new chapter in the saga of #3249 / #3486 / #4238 / #4316

@scabug
Copy link
Author

scabug commented Mar 6, 2011

@paulp said:
(In r24391) Another corner involving generic signatures and java interop
flushed out by seth tisue. Keep that detector fired up seth or the
rebel alliance will surely be crushed. (In fact, I nominate you
to write a test suite!) Closes #4317, no review.

@scabug
Copy link
Author

scabug commented Mar 6, 2011

@SethTisue said:
compile-time is good now, but runtime's another story:

  ~> scala/dists/latest/bin/scala -version                             
Scala code runner version 2.9.0.r24391-b20110306095638 -- Copyright 2002-2011, LAMP/EPFL
  ~> cat S.scala
object S { def foo(x: Class[_ <: AnyRef], y: Int) = 99 }
  ~> scala/dists/latest/bin/scalac S.scala                             
  ~> cat J.java
public class J {
	public static void main(String[] args) {
		int b = S.foo(String.class, 0);
		System.out.println(b);
	}
}
  ~> javac -classpath .:scala/dists/latest/lib/scala-library.jar J.java
  ~> java -classpath .:scala/dists/latest/lib/scala-library.jar J      
Exception in thread "main" java.lang.NoSuchMethodError: S.foo(Ljava/lang/Class;Ljava/lang/Object;)I
	at J.main(J.java:3)

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@paulp said:
(In r24399) More signature fixes and tests and generally being more sophisticated
about our primitive squashing. These signatures belong in world-class
museums but we are their shepherds for now. Closes #4317, 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