eed3si9n / scalaxb

scalaxb is an XML data binding tool for Scala.
http://scalaxb.org/
MIT License
337 stars 156 forks source link

compile error Scala 2.13.12 with `-Xsource:3` #606

Open xuwei-k opened 1 year ago

xuwei-k commented 1 year ago

scalaxb generate package object with extends XMLProtocol

https://github.com/eed3si9n/scalaxb/blob/4251d3e5f051a2701b30b3886f04ae70c31de3d9/cli/src/main/resources/soapenvelope12_xmlprotocol.scala.template#L9

xmlprotocol.scala:12:18: package object inheritance is deprecated (https://github.com/scala/scala-dev/issues/441);
[error] drop the `extends` clause or use a regular object instead
[error] Scala 3 migration messages are errors under -Xsource:3. Use -Wconf / @nowarn to filter them or add -Xmigration to demote them to warnings.
[error] Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration
[error] object `package` extends XMLProtocol { }
[error]                  ^
eed3si9n commented 1 year ago

I guess we'd have to pick some other solution, like call it object XMLProtocol instead, and tell everyone to add imports everywhere.

som-snytt commented 1 year ago

It was deprecated and undeprecated, and received a meh from dotty at https://github.com/scala/scala/pull/7662#issuecomment-465751076

I'll look at where it came back deprecated. Some adjustments to -Xsource:3 are expected to make it less annoying in 2.13.13, and this seems like a good candidate.

Edit: what a tangled web of history. The deprecation was going to be reverted, but then they decided on -Xsource:2.14 which became -Xsource:3. https://github.com/scala/scala/pull/7662

While it is true that the dotty issue tracker makes noises about not caring about package object bugs because they will go away, probably Scala 2 should only warn under -Xsource:4. Ask me if I'm joking.

The -Wconf:cat=scala3migration&site=xmlprotocol:s solution might be ok? The annoying part is cross-compiling.