-
Notifications
You must be signed in to change notification settings - Fork 21
suppress deprecation warnings over a narrow scope #7934
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7934?orig=1 |
@retronym said (edited on Oct 25, 2013 3:02:15 PM UTC): scala> @deprecated("", "") def foo = 0
foo: Int
scala> object Test { @deprecated("", "") class Coral { def fooForwarder = foo }; object Coral extends Coral }
defined object Test
scala> Test.Coral.fooForwarder
res1: Int = 0 |
@retronym said: |
Topher (topher.the.geek) said: |
@retronym said (edited on Oct 25, 2013 3:28:22 PM UTC): |
Thayne (thayne) said: |
Ben Hutchison (ben_hutchison) said: |
Pedro Larroy said: |
Devin Ben-Hur (dbenhur) said: |
Thayne (thayne) said (edited on Jun 26, 2015 6:32:23 PM UTC): +1 reopening. |
Thayne (thayne) said: |
Jonathan Word (Argoday) said: This is a ridiculous workaround ... that behavior should be a bug .. and as far as I can tell doesn't work anymore (yay - bug fixed) |
Nicolas F Rouquette (NicolasRouquette) said: |
Tomer Gabel (holograph) said: |
Tomer Gabel (holograph) said: > ++2.10.3
[info] Setting version to 2.10.3
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/tomerga/dev/accord/)
> show console::scalacOptions
[info] List(-language:reflectiveCalls, -feature, -deprecation, -unchecked, -Xfatal-warnings)
[success] Total time: 0 s, completed Jul 17, 2016 11:50:31 AM
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions to have them evaluated.
Type :help for more information.
scala> @deprecated("", "") def foo = 0
<console>:5: error: method foo is deprecated:
lazy val $result = `foo` |
Tomer Gabel (holograph) said: If you want to see this in action, the Accord codebase has a branch that cross-compiles between 2.10.3 and 2.11.1 that showcases this issue. |
@SethTisue said: This is definitely a real problem; I'm sorry we weren't able to prioritize it for Scala 2.12.0. As an aside, cross-compiling across major Scala versions can get pretty painful, for a variety of reasons. If you want cross-compiling and -Xfatal-warnings, I would expect trouble in many areas. Tomer: Mr. Marki is known for his sometimes cryptic sense of humor, which can result in occasional misunderstandings (or simple incomprehension). I promise you he's helpful, pleasant, and a gentleman. |
@SethTisue said: |
Bumping this, hopefully out of oblivion. This requires me to give up -Xfatal-warnings, which is not a Good Thing To Do. |
I would propose to implement fine-granular warning settings. So, for each kind of a warning we should be able choose one of 3 possible alert levels, The only problem is how to identify warnings - there is no Actually we may implement two solutions (both of them may co-exist):
At the end we would be able to do smth like This should be relatively easy to implement and it should significantly improve our experience. Related topic: https://contributors.scala-lang.org/t/fine-granular-warnings-silencing/ |
@omervk The "silencer" plugin works for this I must say, specifically the (dangerous) part of it that disables warnings based on a pattern: https://github.com/ghik/silencer#global-regex-based-suppression |
I just have the same problems. I am using -Xfatal-warnings and I have a library in which I have to deprecate a function, but I do not want to delete the unit tests for that function. |
I'm looking at scala/scala-dev#333 currently, too late for 2.13.1, but hopefully we'll get something for 2.13.2. https://github.com/ghik/silencer was mentioned before, I can recommend you to give it a try. |
@sourcekick One workaround for tests that may or may not work for you, is to disable fatal warnings (or deprecations) in sbt. scalacOptions in Test ~= (_ filterNot (_ == "-Xfatal-warnings")) |
:squirrel: scala/scala#8373 |
Sometimes I'm forced to use a deprecated method. I need to filter these case by case, so that the warnings remain useful generally. I do appreciate these warnings and act on them when I can, but if my build output becomes overrun with warnings I can do nothing about, I will eventually just ignore them all.
I've open this but to clarify #1781
The text was updated successfully, but these errors were encountered: