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

constructor param names are not accessible from Java reflection Contructor Params for case classes #11486

Closed
pjfanning opened this issue Feb 20, 2021 · 1 comment · Fixed by #11515
Assignees
Milestone

Comments

@pjfanning
Copy link
Contributor

pjfanning commented Feb 20, 2021

Compiler version

3.0.0-RC1

Minimized code

case class TestCaseClass(oof: String, bar: String)

val cls = classOf[TestCaseClass]

val constructor = cls.getConstructors.head

val param1 = constructor.getParameters.head

println(s"constructor params ${constructor.getParameters.map(_.getName).toSeq}")

Output

constructor params ArraySeq(arg0, arg1)

Java class ConstructorParameters default to using the form arg0 when the underlying name is null.

Expectation

Same code in Scala 2.13.4 produces

constructor params ArraySeq(oof, bar)

Jackson-Module-Scala currently depends on java reflection for most of its functionality and the missing names in the constructor params affect a number of use cases.

@SethTisue
Copy link
Member

the PR with Scala 2's support for this was scala/scala#4735 (2016)

@Kordyjan Kordyjan self-assigned this Feb 22, 2021
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants