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

macroRW: method annotate in trait Annotator is deprecated: Not used, left for binary compatibility #582

Closed
avhou opened this issue May 23, 2024 · 5 comments

Comments

@avhou
Copy link

avhou commented May 23, 2024

Hi,
after upgrading from 3.3.0 to 3.3.1 I'm getting compile issues when automatically deriving ReadWriters using macroRW. Error message is : method annotate in trait Annotator is deprecated: Not used, left for binary compatibility.

I'm using scala 2.13.14, sbt 1.10.0

I have a hierarchy like this :

  sealed trait AA
  object AA {
    implicit val rw: ReadWriter[AA] = macroRW
  }

  sealed trait BB extends AA
  object BB {
    implicit val rw: ReadWriter[BB] = macroRW
  }

  @upickle.implicits.key("key1")
  final case class CC(
      @upickle.implicits.key("key2") field: String
  ) extends BB
  object CC {
    implicit val rw: ReadWriter[CC] = macroRW
  }

This compiled in 3.3.0 but no longer does in 3.3.1. Am I missing something obvious here?

thanks!

@lihaoyi
Copy link
Member

lihaoyi commented May 23, 2024

Seems related to #579. @mrdziuban do you have any idea what's happening here?

@mrdziuban
Copy link
Contributor

I'm taking a look but can't reproduce it with your code snippet @avhou. It compiles without deprecation both in Scastie and on my laptop. Are you using upickle.default? Would you be able to share a snippet that definitely has the deprecation warning?

@mrdziuban
Copy link
Contributor

As far as I can tell, the only call to annotate in the Scala 2 macros is here which is referring to the new, non-deprecated version.

This is a shot in the dark, but is it possible that there's an incremental compilation issue involved here? That is, the macro invocation in your code wasn't recompiled so the code produced by macroRW is still the version from 3.3.0, but is referring to the annotate methods in 3.3.1.

Have you tried a clean followed by a compile?

@avhou
Copy link
Author

avhou commented May 23, 2024

@mrdziuban sorry, I forget to mention, I'm not using upickle.default, I'm using the Option to null instead of [] writer and reader (as documented). This was in another project and that project was still using upickle 3.2.0. After upgrading the project containing the customized reader and writer to 3.3.1, the problem disappeared.

Sorry I didn't think of this, thank you kindly for the quick replies!

@mrdziuban
Copy link
Contributor

No worries! So you're all set and this is good to close?

@avhou avhou closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants