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

Using scala-collection-compat together with silencer-plugin is broken #63

Closed
sideeffffect opened this issue Jan 27, 2021 · 12 comments
Closed

Comments

@sideeffffect
Copy link
Contributor

When the scala-collection-compat library is used together with the silencer-plugin compiler plugin, you get errors like this:

[error] /home/runner/work/izumi-reflect/izumi-reflect/izumi-reflect/izumi-reflect/src/main/scala/izumi/reflect/internal/fundamentals/collections/IzMappings.scala:26:4: expected literal string as @nowarn annotation argument
[error]   @nowarn("msg=deprecated")
[error]    ^

Workaround is to drop silencer-plugin, but that might not be the desired solution.

It's worth to note that scala-collection-compat defines its own nowarn annotation: https://github.com/scala/scala-collection-compat/blob/master/compat/src/main/scala-2.11_2.12/scala/annotation/nowarn.scala

Related:
zio/izumi-reflect#121
scala/scala-collection-compat#413 (comment)
scala/scala-collection-compat#417

/cc @SethTisue @ekrich

continuation of scala/scala-collection-compat#418

@ghik
Copy link
Owner

ghik commented Jan 28, 2021

What Scala version is this?

@sideeffffect
Copy link
Contributor Author

2.11.12, I think. When we upgraded izumi-reflect Scala Native 0.4.0, we also had to upgrade to scala-collection-compat to 2.4.0.
We had to remove silencer in order to make the build pass: zio/izumi-reflect#121

Trying to add it back is still causing these issues: zio/izumi-reflect#128

@rdesgroppes
Copy link

I faced the very same problem when trying to bump scala-collection-compat version from 2.3.2 up to 2.4.0, then to 2.4.1. It seems related to this recently introduced change, make @nowarn a ClassfileAnnotation, as in 2.12.13:
scala/scala-collection-compat@86475b4#diff-6d5efe0f0fcfb13692e6abe75577291796099973c93b40ffe8e8bed7db0ea5c6

@ghik ghik closed this as completed in 391a14f Feb 1, 2021
@sideeffffect
Copy link
Contributor Author

@ghik are you planing on making a release soon?

@ghik
Copy link
Owner

ghik commented Feb 1, 2021

@sideeffffect there should be 1.7.2 soon, see https://github.com/ghik/silencer/actions

@sideeffffect
Copy link
Contributor Author

sideeffffect commented Feb 1, 2021

For the record, it solves the issue we had in izumi-reflect zio/izumi-reflect#128
Many thanks 😃

@rdesgroppes
Copy link

there should be 1.7.2 soon, see https://github.com/ghik/silencer/actions

I see the plugin got published for Scala 2.12.13, but not for other versions. @ghik, is that intentional?

@ghik
Copy link
Owner

ghik commented Feb 2, 2021

@rdesgroppes mvnrepository.com seems to be out of sync, search.maven.org shows other versions

@rdesgroppes
Copy link

rdesgroppes commented Feb 2, 2021

Thanks, @ghik, I indeed see more Scala versions there: https://search.maven.org/search?q=g:com.github.ghik%20AND%20a:silencer-plugin_*%20AND%20v:1.7.2
... unfortunately even recent versions of sbt (1.4.7) still use the Scala 2.12.12 compiler and therefore don't find the corresponding compilerPlugin("com.github.ghik" % "silencer-plugin" % "1.7.2" cross CrossVersion.full)...

@ghik
Copy link
Owner

ghik commented Feb 2, 2021

@rdesgroppes yes, I don't cover all minor Scala versions because that would be a cross-building nightmare considering all the minor changes that might be introduced into the compiler API with every minor Scala version. In this case, 2.12.13 broke compatibility of error reporting API with 2.12.12 so I decided to drop 2.12.12 and assumed users can bump their Scala version.

@rdesgroppes
Copy link

rdesgroppes commented Feb 3, 2021

[...] I decided to drop 2.12.12 and assumed users can bump their Scala version.

@ghik Fair enough. But, since:

  1. as of today (Feb 3, 2021), there's no release of sbt based on a Scala 2.12.13 runtime,
  2. silencer-plugin 1.7.1 is incompatible with scala-collection-compat 2.4.0+.

... should a further note be added to https://github.com/ghik/silencer/blob/master/README.md#silencer-scala-compiler-plugin-for-warning-suppression so that sbt users stick to silencer-plugin 1.7.1 and scala-collection-compat 2.3.2?

@ghik
Copy link
Owner

ghik commented Feb 3, 2021

@rdesgroppes Since you're bound by Scala version used by sbt, I'm assuming you are developing an sbt plugin? I'm not familiar with sbt plugin development but in principle you should be able to force 2.12.13 to be used in your plugin. This should work because minor Scala versions are supposed to be both backwards and forward compatible.

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