unchecked.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 44 行

SCALA
44
字号
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2002-2007, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id: unchecked.scala 10880 2007-04-29 16:23:07Z mihaylov $package scala/** <p> *    An annotation that gets applied to a selector in a match expression. *    If it is present, exhaustiveness warnings for that expression will be *    suppressed. *  </p> *  <p> *    For example, compiling the code: *  </p><pre> *    <b>object</b> test <b>extends</b> Application { *      <b>def</b> f(x: Option[int]) = x <b>match</b> { *        <b>case</b> Some(y) => y *      } *      f(None) *    }</pre> *  <p> *    will display the following warning: *  </p><pre> *    test.scala:2: warning: does not cover case {object None} *      def f(x: Option[int]) = x match { *                              ^ *    one warning found</pre> *  <p> *    The above message may be suppressed by substituting the expression *    <code>x</code> with <code>(x: @unchecked)</code>. Then the *    modified code will compile silently, but, in any case, a *    <a href="MatchError.html"><code>MatchError</code></a> *    will be raised at runtime. *  </p> */class unchecked extends Annotation {}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?