lightbend / genjavadoc

A compiler plugin for generating doc’able Java source from Scala source
Other
58 stars 32 forks source link

more robust annotation retrieval #287

Closed jrudolph closed 3 years ago

jrudolph commented 3 years ago

This started to fail with 2.13.6 as annotation.toString was just deprecated for the companion object. The case class symbol annotation toString itself still seems to contain the parameters.

@SethTisue do you know whether that might have been a change only in toString behavior between 2.13.5 and 2.13.6 or if copying over annotations from case class to it's generated companion object might have changed?

Fixes #286.

SethTisue commented 3 years ago

Looking through the 2.13.6 merged PRs, the only one that jumps out at me is https://github.com/scala/scala/pull/9336 , which changed @deprecated to extend ConstantAnnotation rather than StaticAnnotation

Is there a little experiment we can do in the REPL that demonstrates the changed behavior?

SethTisue commented 3 years ago

2.13.6:

scala 2.13.6> :power
Already in power mode.

scala 2.13.6> @deprecated("", "") case class C()
class C

scala 2.13.6> typeOf[C].typeSymbol.companionModule.moduleClass.annotations.head.toString
                     ^
              warning: class C is deprecated:
val res0: String = deprecated

whereas in 2.13.5 the result at the end is deprecated("", "")

jrudolph commented 3 years ago

Dale and I poked at this for a while and convinced ourselves that scala/scala#9336 is in fact the cause.

Thanks! Good to know it's probably something harmless.