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

Annotation on constructor field get lost #13569

Closed
wiwiwa opened this issue Sep 21, 2021 · 1 comment
Closed

Annotation on constructor field get lost #13569

wiwiwa opened this issue Sep 21, 2021 · 1 comment

Comments

@wiwiwa
Copy link

wiwiwa commented Sep 21, 2021

Compiler version

3.0.2

Minimized code

import scala.annotation.meta.{field, getter}

case class TestCaseClass(
  @(Deprecated @field) val conField: String
):
  @Deprecated val memberField: String = null

@main def test() =
  val clazz = classOf[TestCaseClass]
  val conFieldAnn = clazz.getDeclaredField("conField").getDeclaredAnnotations.toList
  println(conFieldAnn)
  val memberFieldAnn = clazz.getDeclaredField("memberField").getDeclaredAnnotations.toList
  println(memberFieldAnn)

Output

List()
List(@java.lang.Deprecated(forRemoval=false, since=""))

Expectation

Both println should output same annotation list.

List(@java.lang.Deprecated(forRemoval=false, since=""))
List(@java.lang.Deprecated(forRemoval=false, since=""))
@smarter
Copy link
Member

smarter commented Sep 22, 2021

Duplicate of #12492

@smarter smarter marked this as a duplicate of #12492 Sep 22, 2021
@smarter smarter closed this as completed Sep 22, 2021
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

3 participants