Ben*_*man 52 scala suppress-warnings
我想知道scala是否有相当于java的@SuppressWarnings可以应用于函数或任何忽略函数发出的任何弃用警告[1]?
1:在我的情况下的相关警告是:method stop in class Thread is deprecated: see corresponding Javadoc for more information.我知道停止的问题,但仍有一些情况由于遗留代码我们必须使用它.
ret*_*nym 26
不,并且关闭此类功能的增强请求[1] wontfix.
我同意它会有用.我希望Scala核心团队不反对这个想法,但他们拥有有限的资源和更高的优先级.
[1] https://issues.scala-lang.org/browse/SI-1781
Mar*_*lic 15
Scala 2.13.2 提供@nowarn了在 ghik 的基础上开发的注解silencer,例如
import scala.annotation.nowarn
def t = { 0: @nowarn; 1 }
Run Code Online (Sandbox Code Playgroud)
不发出警告,而
def t = { 0; 1 }
Run Code Online (Sandbox Code Playgroud)
给
warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
def t = { 0; 1 }
^
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13281 次 |
| 最近记录: |