Is there an equivalent to SuppressWarnings in Scala?

BenjaminJackman picture BenjaminJackman · Aug 17, 2010 · Viewed 16.6k times · Source

I was wondering if scala had an equivalent to java's @SuppressWarnings that can be applied to a function or whatever to ignore any deprecation warnings[1] that function emits?

1: Relevant warning in my case is: method stop in class Thread is deprecated: see corresponding Javadoc for more information. I am aware of the problems with stop however there are still some cases where due to legacy code we have to use it.

Answer

retronym picture retronym · Aug 17, 2010

No, and an enhancement request [1] for such a feature was closed as wontfix.

I agree it would be useful. I expect that the Scala core team aren't against the idea, but they have finite resources and many higher priorities.

update: this feature was eventually implemented in scala 2.13.2 release on 2020-04-22, see this answer

[1] https://issues.scala-lang.org/browse/SI-1781