What risk do I have using annotation.unused on my provided readResolve method in a case class

I am currently getting a syntax highlight error within IntelliJ+Scala plugin on a readResolve method I have provided within a case class.

I reported it to IntelliJ back in 2016. While it was marked as a bug, it has yet to be resolved:

I would like to use @annotation.unused on the method to stop the syntax highlight error. However, I am concerned the annotation might trigger some form of “dead code elimination”.

To meta up, is there some other means than annotation.unused to suppress the syntax highlighting error? Or is it safe to use said annotation?

The annotation is intended for your use case, though I don’t know whether IDEs use it.

The -Xlint warning (-Wunused) skips those serialization utility methods. (It’s too generous and skips anything named readResolve.)

unused was partly superseded by nowarn.

1 Like