-
Notifications
You must be signed in to change notification settings - Fork 21
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
Type argument of class scala.Int is resolved to java.lang.Object when discovering type arguments using Java reflection #4948
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4948?orig=1
|
@paulp said: |
Shai Yallin (electricmonk) said: |
@paulp said: |
@SethTisue said: |
Shai Yallin (electricmonk) said (edited on Aug 30, 2011 5:40:30 AM UTC): #4214 seems to have been resolved if you look at the comment from the original reporter, but nowhere do I see a reference to a solution that resolves the primitive generic type issue. I've linked this issue to the "metabug" #4912, I hope to see a fix soon, and I would love to hear from @paulp why there's not much that can be done about it. |
@retronym said: It's best to consult the mailing list before raising a ticket unless you're sure that it it's a bug, and not a duplicate. There is a conflict between the Java generics, which can only accept AnyRef type parameters, and the Scala type system, which can include AnyVals. For this reason, some information must be erased. Here are a few threads that highlight the difficulty of the problem. http://www.scala-lang.org/node/8888 You're really after a Scala specific reflection API. The good news is that this is coming in Scala 2.10. In the meantime, take a look at Salat, which uses the Scala Decompiler (scalap) to extract the same information. |
We're using a legacy infrastructure for data conversion based on the Dozer project, for which we wrote some scala-specific adapters. Everything works properly except for fields that are generic on scala.Int, such as Option[Int] or List[Int]. After some research it appears that the Java reflection system fails to discover the type argument for Option[Int], whereas it succeeds in doing so for Option[String].
Please see the attached file which reproduces the issue.
The text was updated successfully, but these errors were encountered: