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

Some Java codes using wildcard type and "raw type" are not correctly typed. #4769

Closed
scabug opened this issue Jul 5, 2011 · 3 comments
Closed

Comments

@scabug
Copy link

scabug commented Jul 5, 2011

The folowing Java code compiles.

public class J {
public static void setClass(Class<? extends java.util.List> clazz) {
System.out.println(clazz.getName());
}
}

Then, in Scala REPL, the following type error occurs:

scala> J.setClass(classOf[java.util.ArrayList[]])
:8: error: type mismatch;
found : java.lang.Classjava.util.ArrayList[_]
required: java.lang.Class[
<: java.util.List]
J.setClass(classOf[java.util.ArrayList[_]])

It seems that "Class<? extends java.util.List>" is typed as "Class[_ <: java.util.List]" instead of "Class[_ <: java.util.List[_]]".
And scalac reports the same error.

In Scala 2.8.1.final, This error doesn't occur.

@scabug
Copy link
Author

scabug commented Jul 5, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4769?orig=1
Reporter: @kmizu
Attachments:

  • J.java (created on Jul 5, 2011 1:19:01 PM UTC, 148 bytes)
  • UsingJ.scala (created on Jul 5, 2011 1:19:01 PM UTC, 96 bytes)

@scabug
Copy link
Author

scabug commented Jul 6, 2011

@paulp said:
This is caused by r24275, the line in rawToExistential commented "stop to avoid infinite expansions".

@scabug
Copy link
Author

scabug commented Jul 6, 2011

@paulp said:
This is a duplicate of #4603.

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