Skip to content

Retrieving type arguments through Java reflection does not work #10872

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
pjfanning opened this issue Dec 20, 2020 · 1 comment
Closed

Retrieving type arguments through Java reflection does not work #10872

pjfanning opened this issue Dec 20, 2020 · 1 comment

Comments

@pjfanning
Copy link
Contributor

Minimized code

https://github.com/pjfanning/scala3-sample-classes/blob/annotation-issue/src/test/scala/com/github/pjfanning/scala3/ClassWithMapsSpec.scala

https://github.com/pjfanning/scala3-sample-classes/blob/annotation-issue/src/main/scala/com/github/pjfanning/scala3/ClassWithMaps.scala

Output

[info] - should support TypeReference *** FAILED ***
[info]   java.lang.IllegalArgumentException: Internal error: TypeReference constructed without actual type information
[info]   at com.fasterxml.jackson.core.type.TypeReference.<init>(TypeReference.java:35)
[info]   at com.github.pjfanning.scala3.ClassWithMapsSpec$$anon$1.<init>(ClassWithMapsSpec.scala:12)

Expectation

This test case passes in Scala 2.13.

https://github.com/FasterXML/jackson-core/blob/2.12/src/main/java/com/fasterxml/jackson/core/type/TypeReference.java

This class tries to get the generic super class and this is the parameterized type in Scala 2.13 - eg new TypeReference[ClassWithMaps[String]]{} yields ClassWithMaps[String] but this does not work in Scala 3.0.0-M3.

@smarter smarter changed the title Generics use case that works in Scala 2 but not in Scala 3.0.0-M3 Retrieving type arguments through Java reflection does not work Dec 20, 2020
@smarter
Copy link
Member

smarter commented Dec 20, 2020

Duplicate of #6349

@smarter smarter marked this as a duplicate of #6349 Dec 20, 2020
@smarter smarter closed this as completed Dec 20, 2020
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